This repository has been archived on 2023-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
chainsafe-bls/test/switch.ts

33 lines
792 B
TypeScript
Raw Normal View History

2020-11-19 13:22:41 +00:00
import blst from "../src/blst";
import herumi from "../src/herumi";
export type Implementation = "blst" | "herumi";
export const implementations: Implementation[] = ["blst", "herumi"];
export function getBls(implementation: Implementation) {
switch (implementation) {
case "blst":
return blst;
case "herumi":
return herumi;
}
}
export function forEachImplementation(
callback: (bls: ReturnType<typeof getBls>, implementation: Implementation) => void
): void {
for (const implementation of implementations) {
describe(implementation, () => {
const bls = getBls(implementation);
2020-11-19 13:22:41 +00:00
if (implementation === "herumi") {
before(async () => {
await bls.initBLS();
});
}
2020-11-19 13:22:41 +00:00
callback(bls, implementation);
});
2020-11-19 13:22:41 +00:00
}
}