test(core): verify that token IDs that exceed the bloom filter size are handled correctly (#40489)
This commits adds additional expectations to verify that the bloom filter is able to correctly handle token IDs that exceed the size of the bloom filter (which is currently 256 bits). PR Close #40489
This commit is contained in:
parent
fad1083873
commit
69385f7df4
|
@ -182,6 +182,9 @@ describe('di', () => {
|
|||
class Dir231 {
|
||||
/** @internal */ static __NG_ELEMENT_ID__ = 231;
|
||||
}
|
||||
class Dir260 {
|
||||
/** @internal */ static __NG_ELEMENT_ID__ = 260;
|
||||
}
|
||||
|
||||
it('should add values', () => {
|
||||
bloomAdd(0, mockTView, Dir0);
|
||||
|
@ -200,6 +203,8 @@ describe('di', () => {
|
|||
expect(bloomState()).toEqual([0, 64, 32, 16, 8, 4, 2, 1]);
|
||||
bloomAdd(0, mockTView, Dir231);
|
||||
expect(bloomState()).toEqual([128, 64, 32, 16, 8, 4, 2, 1]);
|
||||
bloomAdd(0, mockTView, Dir260);
|
||||
expect(bloomState()).toEqual([128, 64, 32, 16, 8, 4, 2, 17 /* 1 + 2^(260-256) */]);
|
||||
});
|
||||
|
||||
it('should query values', () => {
|
||||
|
@ -211,6 +216,7 @@ describe('di', () => {
|
|||
bloomAdd(0, mockTView, Dir165);
|
||||
bloomAdd(0, mockTView, Dir198);
|
||||
bloomAdd(0, mockTView, Dir231);
|
||||
bloomAdd(0, mockTView, Dir260);
|
||||
|
||||
expect(bloomHasToken(bloomHash(Dir0) as number, 0, mockTView.data)).toEqual(true);
|
||||
expect(bloomHasToken(bloomHash(Dir1) as number, 0, mockTView.data)).toEqual(false);
|
||||
|
@ -221,6 +227,7 @@ describe('di', () => {
|
|||
expect(bloomHasToken(bloomHash(Dir165) as number, 0, mockTView.data)).toEqual(true);
|
||||
expect(bloomHasToken(bloomHash(Dir198) as number, 0, mockTView.data)).toEqual(true);
|
||||
expect(bloomHasToken(bloomHash(Dir231) as number, 0, mockTView.data)).toEqual(true);
|
||||
expect(bloomHasToken(bloomHash(Dir260) as number, 0, mockTView.data)).toEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue