nimbus-eth2/tests/official/test_fixture_shuffling.nim
Mamy Ratsimbazafy 2a4c4df7c3
Bls official tests (#268)
* Update fixtures with BLS and SSZ generic

* Stash changes following https://github.com/status-im/nim-serialization/issues/4

* Add Private to Public key conversion

* Add message signing tests

* Add aggregate signatures and public keys

* Add BLS to test suite
2019-05-23 09:41:17 +02:00

30 lines
1.1 KiB
Nim

# beacon_chain
# Copyright (c) 2018 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import
# Standard libs
ospaths, strutils, json, unittest,
# Third parties
# Beacon chain internals
../../beacon_chain/spec/validator,
# Test utilities
./fixtures_utils
const TestFolder = currentSourcePath.rsplit(DirSep, 1)[0]
const TestsPath = "fixtures" / "json_tests" / "shuffling" / "core" / "shuffling_full.json"
var shufflingTests: Tests[Shuffling]
suite "Official - Shuffling tests":
test "Parsing the official shuffling tests":
shufflingTests = parseTestsShuffling(TestFolder / TestsPath)
test "Shuffling a sequence of N validators":
for t in shufflingTests.test_cases:
let implResult = get_shuffled_seq(t.seed, t.count)
check: implResult == t.shuffled