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.

wrapped_test.gno

0.58 Kb · 21 lines
 1package wrapped
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/nt/uassert/v0"
 7)
 8
 9func TestCanDebit(t *testing.T) {
10	uassert.True(t, canDebit(100, 40), "bal covers amount")
11	uassert.True(t, canDebit(50, 50), "exact balance is debitable")
12	uassert.False(t, canDebit(10, 20), "amount exceeds balance")
13	uassert.False(t, canDebit(100, 0), "zero amount is never debitable")
14	uassert.False(t, canDebit(0, 1), "empty balance cannot be debited")
15}
16
17func TestFormatUnits(t *testing.T) {
18	uassert.Equal(t, "0", formatUnits(0))
19	uassert.Equal(t, "1", formatUnits(1))
20	uassert.Equal(t, "1000000", formatUnits(1_000_000))
21}