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

0.86 Kb · 27 lines
 1package erc721
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/nt/uassert/v0"
 7)
 8
 9func TestKeyPaddingSortable(t *testing.T) {
10	// keys must be fixed-width so avl iteration is numeric-order.
11	uassert.Equal(t, "000000000001", key(1))
12	uassert.Equal(t, "000000000042", key(42))
13	uassert.Equal(t, "000000123456", key(123456))
14	// lexical order must match numeric order
15	uassert.True(t, key(2) < key(10), "padded key(2) should sort before key(10)")
16	uassert.True(t, key(99) < key(100), "padded key(99) should sort before key(100)")
17}
18
19func TestReadOnlyDefaults(t *testing.T) {
20	// on a fresh realm nothing is minted.
21	uassert.Equal(t, int64(0), totalSupply())
22	uassert.False(t, exists(1), "token 1 must not exist before minting")
23
24	var someone address = "g1someoneelsehere000000000000000000000000"
25	uassert.Equal(t, uint64(0), balanceOf(someone))
26	uassert.Equal(t, "", approvedOf(1).String())
27}