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.

counter_test.gno

0.41 Kb · 22 lines
 1package counter
 2
 3import "testing"
 4
 5func TestIncrement(cur realm, t *testing.T) {
 6	counter = 0
 7	val := Increment(cross(cur))
 8	if val != 1 {
 9		t.Fatalf("result from Increment(): %d != 1", val)
10	}
11	if counter != val {
12		t.Fatalf("counter (%d) != val (%d)", counter, val)
13	}
14}
15
16func TestRender(t *testing.T) {
17	counter = 1337
18	res := Render("")
19	if res != "1337" {
20		t.Fatalf("render result %q != %q", res, "1337")
21	}
22}