Server IP : 92.205.26.207 / Your IP : 216.73.216.16 Web Server : Apache System : Linux 207.26.205.92.host.secureserver.net 4.18.0-553.60.1.el8_10.x86_64 #1 SMP Thu Jul 10 04:01:16 EDT 2025 x86_64 User : zikryat ( 1002) PHP Version : 8.3.23 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/zikryat/public_html/node_modules/@socket.io/../memory-pager/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
var tape = require('tape') var pager = require('./') tape('get page', function (t) { var pages = pager(1024) var page = pages.get(0) t.same(page.offset, 0) t.same(page.buffer, Buffer.alloc(1024)) t.end() }) tape('get page twice', function (t) { var pages = pager(1024) t.same(pages.length, 0) var page = pages.get(0) t.same(page.offset, 0) t.same(page.buffer, Buffer.alloc(1024)) t.same(pages.length, 1) var other = pages.get(0) t.same(other, page) t.end() }) tape('get no mutable page', function (t) { var pages = pager(1024) t.ok(!pages.get(141, true)) t.ok(pages.get(141)) t.ok(pages.get(141, true)) t.end() }) tape('get far out page', function (t) { var pages = pager(1024) var page = pages.get(1000000) t.same(page.offset, 1000000 * 1024) t.same(page.buffer, Buffer.alloc(1024)) t.same(pages.length, 1000000 + 1) var other = pages.get(1) t.same(other.offset, 1024) t.same(other.buffer, Buffer.alloc(1024)) t.same(pages.length, 1000000 + 1) t.ok(other !== page) t.end() }) tape('updates', function (t) { var pages = pager(1024) t.same(pages.lastUpdate(), null) var page = pages.get(10) page.buffer[42] = 1 pages.updated(page) t.same(pages.lastUpdate(), page) t.same(pages.lastUpdate(), null) page.buffer[42] = 2 pages.updated(page) pages.updated(page) t.same(pages.lastUpdate(), page) t.same(pages.lastUpdate(), null) t.end() })