aboutsummaryrefslogtreecommitdiff
path: root/vote/vote_test.go
blob: 6ff41b8a2c12b78867f7a64449a23398f24e67bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package vote

import (
	"testing"
)

func TestVoteGeneration(t *testing.T) {

	for i := range 100 {
		bit := i%3 == 1
		vote, e := newVoteWithRand(bit, uint64(i), nil)

		if e != nil {
			t.Fatalf("unexpected error: %v", e)
		}
		if vote.bit != bit {
			t.Fatalf("expected vote %t, but got %t", bit, vote.bit)
		}
		if !vote.VerifyProofs() {
			t.Fatalf("Proofs not correct! %+v", vote)
		}

		t.Logf("Generated %+v\n", vote)
	}
}