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("g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh")
11	hariom := address("g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh")
12
13	for _, tc := range []struct {
14		name     string
15		expected any
16		fn       func() any
17	}{
18		{"BalanceOf(admin)", int64(15), func() interface{} { return BalanceOf(admin) }},
19		{"BalanceOf(hariom)", int64(15), 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}