github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/cmd/bootstrap/dkg/dkg_test.go (about) 1 package dkg 2 3 import ( 4 "testing" 5 6 "github.com/onflow/crypto" 7 "github.com/stretchr/testify/require" 8 9 "github.com/onflow/flow-go/utils/unittest" 10 ) 11 12 func TestBeaconKG(t *testing.T) { 13 seed := unittest.SeedFixture(2 * crypto.KeyGenSeedMinLen) 14 15 // n = 0 16 _, err := RandomBeaconKG(0, seed) 17 require.EqualError(t, err, "Beacon KeyGen failed: size should be between 2 and 254, got 0") 18 19 // should work for case n = 1 20 _, err = RandomBeaconKG(1, seed) 21 require.NoError(t, err) 22 23 // n = 4 24 data, err := RandomBeaconKG(4, seed) 25 require.NoError(t, err) 26 require.Len(t, data.PrivKeyShares, 4) 27 require.Len(t, data.PubKeyShares, 4) 28 }