* Start codec implementation * Expose all constants * NodeHeader encoding/decoding * Encoding in NodeHeader * Constants for Node types * Moce codec to trie-codec * Encode/decode in place (untested) * WIP, tests starting to be put in place * One passing test :) * Another test bites the dust... * One more test down... * One more down * Additional tests * Formatting * Long keys passing * Trie tests * Follow the script, no all-in-all encoder * First simple trie test passing * Another one down * Extra checks remove (debug) * 80% there with tests... * One more, one left * Trie tests passing * ISC -> Apache-2.0 * Add compact util functions * Tests to TypeScript * Remove @polkadot/types deps, ethereum stub * Bump * Genesis tests with chainspecs * Cleanup tests (ease of debugging) * Substrate test passes, branch fails (again) * Checks passing, tests passing * Re-add Ethereum & snapshot tests (not passing atm) * Re-add index test (also not 100%) * Mid-way in generic trie-root * Cleanup ethereumjs-testing definitions * Update deps * Less intrusive renames in trie-hash * Self-review cleanups #1 * asNibbles -> toNibbles * Cleanups * Expand tests * Cleanup imports * Fix logger test (fly-by refactor) * Update snapshot test
24 lines
708 B
TypeScript
24 lines
708 B
TypeScript
// Copyright 2017-2018 @polkadot/util-rlp authors & contributors
|
|
// This software may be modified and distributed under the terms
|
|
// of the MPL-2.0 license. See the LICENSE file for details.
|
|
|
|
import BN from 'bn.js';
|
|
import { getSingleFile } from 'ethereumjs-testing';
|
|
|
|
import bnToU8a from '@polkadot/util/bn/toU8a';
|
|
|
|
export default function getTests (file: string) {
|
|
const tests = getSingleFile(file);
|
|
|
|
return Object.keys(tests).map((name) => ({
|
|
name,
|
|
input: tests[name].in[0] !== '#'
|
|
? tests[name].in
|
|
: bnToU8a(new BN(tests[name].in.slice(1)), -1, true),
|
|
output: tests[name].out
|
|
? `0x${tests[name].out.toLowerCase()}`
|
|
: undefined,
|
|
root: tests[name].root
|
|
}));
|
|
}
|