Skip to content Search Apps Documentation Source Content Run Reset Eval Playground 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.

flight_test.gno

0.98 Kb · 36 lines
 1package flight
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/nt/uassert/v0"
 7)
 8
 9const ash = address("g1zkzjmyveh7euq83h5zhnhj6mg0d7kr35nphzd2")
10
11func TestHonestTabTastesSix(cur realm, t *testing.T) {
12	testing.SetRealm(testing.NewUserRealm(ash))
13	Settle(cross(cur))
14	Taste(cross(cur), "amarone, barolo, chablis")
15	Taste(cross(cur), "dolcetto,etna,fiano")
16	n, left := Tasted(ash)
17	uassert.Equal(t, 6, n)
18	uassert.Equal(t, 0, left)
19	uassert.AbortsContains(t, cur, "no tokens left", func() { Taste(cross(cur), "gavi") })
20	uassert.False(t, captures.Captured(ash))
21}
22
23func TestFlightSize(cur realm, t *testing.T) {
24	testing.SetRealm(testing.NewUserRealm(ash))
25	Settle(cross(cur))
26	uassert.AbortsContains(t, cur, "at most 3", func() { Taste(cross(cur), "gavi,hermitage,irouleguy,amarone") })
27}
28
29func TestSettleResets(cur realm, t *testing.T) {
30	testing.SetRealm(testing.NewUserRealm(ash))
31	Taste(cross(cur), "gavi")
32	Settle(cross(cur))
33	n, left := Tasted(ash)
34	uassert.Equal(t, 0, n)
35	uassert.Equal(t, tokens, left)
36}