Sprinkle in readonly on array inputs (#1568)
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
import { perf } from '../test/performance';
|
||||
import { u8aEmpty } from '.';
|
||||
|
||||
const ztest = new Uint8Array(32);
|
||||
|
||||
describe('u8aEmpty', (): void => {
|
||||
it('returns true on zero length', (): void => {
|
||||
expect(
|
||||
@@ -25,5 +23,22 @@ describe('u8aEmpty', (): void => {
|
||||
).toEqual(false);
|
||||
});
|
||||
|
||||
perf('u8aEmpty (32 cmp)', 1000000, [[ztest]], u8aEmpty);
|
||||
it('returns false when value is found (256)', (): void => {
|
||||
const test = new Uint8Array(256);
|
||||
|
||||
expect(
|
||||
u8aEmpty(test)
|
||||
).toEqual(true);
|
||||
|
||||
test[128] = 1;
|
||||
|
||||
expect(
|
||||
u8aEmpty(test)
|
||||
).toEqual(false);
|
||||
});
|
||||
|
||||
perf('u8aEmpty (32 cmp)', 1_000_000, [[new Uint8Array(32)]], u8aEmpty);
|
||||
perf('u8aEmpty (64 cmp)', 500_000, [[new Uint8Array(64)]], u8aEmpty);
|
||||
perf('u8aEmpty (128 cmp)', 250_000, [[new Uint8Array(128)]], u8aEmpty);
|
||||
perf('u8aEmpty (256 cmp)', 125_000, [[new Uint8Array(256)]], u8aEmpty);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user