Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ltzmaxwell committed Nov 30, 2024
1 parent dc406a9 commit 317c8f7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
File renamed without changes.
4 changes: 4 additions & 0 deletions gnovm/tests/files/ptrmap1.gno
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ func init() {
func main() {
r := GetFromMap()
println(r == 5)

*i = 2
println(r == 5)
}

// Output:
// true
// true
4 changes: 4 additions & 0 deletions gnovm/tests/files/ptrmap2.gno
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ func main() {
var j = 0
j1 := &j
println(m[&j1])

*i = 2
println(r == 5)
}

// Output:
// true
// 0
// true
19 changes: 19 additions & 0 deletions gnovm/tests/files/ptrmap7.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// PKGPATH: gno.land/r/ptr_map
package ptr_map

var m = make(map[*int]string)

func foo(x, y int) {
m[&x] = "a"
m[&y] = "b"
println(m[&x])
println(m[&y])
}

func main() {
foo(1, 1)
}

// Output:
// a
// b

0 comments on commit 317c8f7

Please sign in to comment.