Search Apps Documentation Source Content File Folder Download Copy Actions Download

foo721_test.gno

0.82 Kb ยท 30 lines
 1package foo721
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/demo/tokens/grc721"
 7)
 8
 9func TestFoo721(t *testing.T) {
10	admin := address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj")
11	hariom := address("g1var589z07ppjsjd24ukm4uguzwdt0tw7g47cgm")
12
13	for _, tc := range []struct {
14		name     string
15		expected any
16		fn       func() any
17	}{
18		{"BalanceOf(admin)", int64(10), func() interface{} { return BalanceOf(admin) }},
19		{"BalanceOf(hariom)", int64(5), func() interface{} { return BalanceOf(hariom) }},
20		{"OwnerOf(0)", admin, func() interface{} { return OwnerOf(grc721.TokenID("0")) }},
21		{"IsApprovedForAll(admin, hariom)", false, func() interface{} { return IsApprovedForAll(admin, hariom) }},
22	} {
23		t.Run(tc.name, func(t *testing.T) {
24			got := tc.fn()
25			if tc.expected != got {
26				t.Errorf("expected: %v got: %v", tc.expected, got)
27			}
28		})
29	}
30}