Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

erc721_test.gno

1.11 Kb · 29 lines
 1package erc721
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/nym-moultest123/kit/store/v0"
 7	"gno.land/p/nt/uassert/v0"
 8)
 9
10// v0 asserted that its own key() padded to width 12. That rule held only below
11// the width: key(10^12) is 13 characters and sorts before key(10^12-1), so the
12// token table would have rendered out of order from that id on. The store key
13// has no width to outgrow, which is what this replaces it with.
14func TestTokenKeysSortNumericallyPastTheOldWidth(t *testing.T) {
15	uassert.True(t, store.ID(2).Key() < store.ID(10).Key(), "2 sorts before 10")
16	uassert.True(t, store.ID(99).Key() < store.ID(100).Key(), "99 sorts before 100")
17	uassert.True(t, store.ID(999999999999).Key() < store.ID(1000000000000).Key(),
18		"and it keeps holding one past v0's width-12 ceiling")
19}
20
21func TestReadOnlyDefaults(t *testing.T) {
22	// on a fresh realm nothing is minted.
23	uassert.Equal(t, int64(0), totalSupply())
24	uassert.False(t, exists(1), "token 1 must not exist before minting")
25
26	var someone address = "g1someoneelsehere000000000000000000000000"
27	uassert.Equal(t, uint64(0), balanceOf(someone))
28	uassert.Equal(t, "", approvedOf(1).String())
29}