From 09d6f2cc9f22f6954ff308b68d395f7d8d63ffa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Isager=20Dalsgar=C3=B0?= Date: Thu, 9 Nov 2023 11:46:43 +0100 Subject: [PATCH] Test set range around bitfield page boundaries (#455) --- test/bitfield.js | 8 ++++++++ test/remote-bitfield.js | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/test/bitfield.js b/test/bitfield.js index 229a116c..17f7e33b 100644 --- a/test/bitfield.js +++ b/test/bitfield.js @@ -238,3 +238,11 @@ test('bitfield - find last, ones around page boundary', async function (t) { t.is(b.lastUnset(32768), 32766) t.is(b.lastUnset(32769), 32769) }) + +test('bitfield - set range on page boundary', async function (t) { + const b = await Bitfield.open(new RAM()) + + b.setRange(2032, 26, true) + + t.is(b.findFirst(true, 2048), 2048) +}) diff --git a/test/remote-bitfield.js b/test/remote-bitfield.js index 84b1c814..46ca23b4 100644 --- a/test/remote-bitfield.js +++ b/test/remote-bitfield.js @@ -8,3 +8,11 @@ test('remote bitfield - findFirst', function (t) { t.is(b.findFirst(true, 0), 1000000) }) + +test('remote bitfield - set range on page boundary', function (t) { + const b = new RemoteBitfield() + + b.setRange(2032, 26, true) + + t.is(b.findFirst(true, 2048), 2048) +})