github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/r/demo/foo721/foo721_test.gno (about) 1 package foo721 2 3 import ( 4 "testing" 5 6 "gno.land/p/demo/grc/grc721" 7 "gno.land/r/demo/users" 8 9 pusers "gno.land/p/demo/users" 10 ) 11 12 func TestFoo721(t *testing.T) { 13 admin := pusers.AddressOrName("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj") 14 hariom := pusers.AddressOrName("g1var589z07ppjsjd24ukm4uguzwdt0tw7g47cgm") 15 16 for i, tc := range []struct { 17 name string 18 expected interface{} 19 fn func() interface{} 20 }{ 21 {"BalanceOf(admin)", uint64(10), func() interface{} { return BalanceOf(admin) }}, 22 {"BalanceOf(hariom)", uint64(5), func() interface{} { return BalanceOf(hariom) }}, 23 {"OwnerOf(0)", users.Resolve(admin), func() interface{} { return OwnerOf(grc721.TokenID("0")) }}, 24 {"IsApprovedForAll(admin, hariom)", false, func() interface{} { return IsApprovedForAll(admin, hariom) }}, 25 } { 26 t.Run(tc.name, func(t *testing.T) { 27 got := tc.fn() 28 if tc.expected != got { 29 t.Errorf("expected: %v got: %v", tc.expected, got) 30 } 31 }) 32 } 33 }