copied set implementations from MultiFlag JS

This commit is contained in:
2026-02-09 22:11:23 +01:00
parent 80c17ac3ac
commit 140896bd7c
56 changed files with 8055 additions and 24 deletions

View File

@@ -0,0 +1,12 @@
import { NumberBitflagSet, ForeignFlagError } from '@module'
test('cannot create a flag with a foreign parent', () => {
const flags = new NumberBitflagSet()
const flagA = flags.flag(1)
const otherFlags = new NumberBitflagSet()
const flagX = otherFlags.flag(1)
flags.flag(2, flagA) // OK
expect(() => flags.flag(4, flagX)).toThrow(ForeignFlagError)
})