source: trip-planner-front/node_modules/hdr-histogram-js/src/ZigZagEncoding.fc.spec.ts@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 721 bytes
Line 
1import * as fc from "fast-check";
2import ByteBuffer from "./ByteBuffer";
3import ZigZagEncoding from "./ZigZagEncoding";
4
5const runFromStryker = __dirname.includes("stryker");
6
7const runnerOptions = {
8 numRuns: runFromStryker ? 10 : 1000,
9};
10
11describe("Zig Zag Encoding", () => {
12 it("should get the same number after an encoding & decoding", () => {
13 const buffer = ByteBuffer.allocate(8);
14 fc.assert(
15 fc.property(fc.nat(Number.MAX_SAFE_INTEGER), (number) => {
16 buffer.resetPosition();
17 ZigZagEncoding.encode(buffer, number);
18 buffer.resetPosition();
19 const result = ZigZagEncoding.decode(buffer);
20 return number === result;
21 }),
22 runnerOptions
23 );
24 });
25});
Note: See TracBrowser for help on using the repository browser.