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.
2022-04-11 15:08:15 +00:00
|
|
|
import {randomBytes} from "../src/helpers/index.js";
|
2020-11-20 12:27:30 +00:00
|
|
|
|
|
|
|
export function randomMessage(): Uint8Array {
|
2020-11-28 19:27:59 +00:00
|
|
|
return randomBytes(32);
|
2020-11-20 12:27:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getN<T>(n: number, getter: () => T): T[] {
|
|
|
|
return Array.from({length: n}, () => getter());
|
|
|
|
}
|
2020-11-30 22:05:19 +00:00
|
|
|
|
|
|
|
export function range(n: number): number[] {
|
|
|
|
const nums: number[] = [];
|
|
|
|
for (let i = 0; i < n; i++) nums.push(i);
|
|
|
|
return nums;
|
|
|
|
}
|
2020-12-03 00:31:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ONLY for NodeJS tests, for any other use src/helpers/hex hexToBytes()
|
|
|
|
* Serves as a "ground-truth" reference
|
|
|
|
*/
|
|
|
|
export function hexToBytesNode(hex: string): Buffer {
|
|
|
|
return Buffer.from(hex.replace("0x", ""), "hex");
|
|
|
|
}
|