import { FaunaTestDb, FaunaTestDbI, teardown } from "fauna-test-setup"; import { Bit32ShiftLeft, Bit32ShiftRight } from "./shift"; import {query as q} from "faunadb"; import { performance } from "perf_hooks"; export const ShiftSuiteA = ()=>{ describe("Shift basic functionality", ()=>{ let db : FaunaTestDbI; beforeAll(async()=>{ db = await FaunaTestDb(); }); test("Left shifts", async ()=>{ for(let i = 0; i < 100; ++i){ const a = Math.floor(Math.random() * 16); const b = Math.floor(Math.random() * 16); const result = await db.client.query(Bit32ShiftLeft(a, b)); expect(result).toBe((a << b) >>> 0); } }); test("Right shifts", async ()=>{ for(let i = 0; i < 100; ++i){ const a = Math.floor(Math.random() * 16); const b = Math.floor(Math.random() * 16); const result = await db.client.query(Bit32ShiftRight(a, b)); expect(result).toBe((a >> b) >>> 0); } }); }) }; ShiftSuiteA();