Playground
contract.gno
package data
var total int
func init() {
total = 1000
}
func Add(nb int) int {
total += nb
return total
}
contract_test.gno
package data
import "testing"
func Test(t *testing.T) {
{ // call 1
got := Add(42)
expected := 1042
if got != expected {
t.Fatalf("expected %d, got %d.", expected, got)
}
}
{ // call 2
got := Add(295)
expected := 1337
if got != expected {
t.Fatalf("expected %d, got %d.", expected, got)
}
}
}
gnomod.toml
module = "gno.land/r/nym-moultest123/demo/data/v0" gno = "0.9" [addpkg] creator = "g1ml9grtwnpzqn3hre5ve5vjdlmv2srrmpmc0dsv" height = 186406 max_deposit = "5000000ugnot"