z_1_filetest.gno

0.48 Kb ยท 28 lines
 1// PKGPATH: gno.land/r/demo/groups_test
 2package groups_test
 3
 4import (
 5	"gno.land/p/demo/groups"
 6	"gno.land/p/demo/testutils"
 7)
 8
 9var vset groups.VoteSet
10
11func init() {
12	addr1 := testutils.TestAddress("test1")
13	addr2 := testutils.TestAddress("test2")
14	vset = groups.NewVoteList()
15	vset.SetVote(addr1, "yes")
16	vset.SetVote(addr2, "yes")
17}
18
19func main() {
20	println(vset.Size())
21	println("yes:", vset.CountVotes("yes"))
22	println("no:", vset.CountVotes("no"))
23}
24
25// Output:
26// 2
27// yes: 2
28// no: 0