aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-05-04 22:33:36 +0200
committerRon Evans <[email protected]>2022-05-18 15:20:09 +0200
commit995e815b6392316fdac7526f8f48112984241092 (patch)
tree128c8fa61f13aa27d081bb383082bcd45c442154 /testdata
parent109b5298c4b2e068a00de5376d9552ace4a5cda4 (diff)
downloadtinygo-995e815b6392316fdac7526f8f48112984241092.tar.gz
tinygo-995e815b6392316fdac7526f8f48112984241092.zip
avr: enable testdata/map.go
The test needs a few changes to support low-memory devices but other than that, it works fine.
Diffstat (limited to 'testdata')
-rw-r--r--testdata/map.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/testdata/map.go b/testdata/map.go
index e4eb6da58..d30889910 100644
--- a/testdata/map.go
+++ b/testdata/map.go
@@ -2,6 +2,7 @@ package main
import (
"sort"
+ "unsafe"
)
var testmap1 = map[string]int{"data": 3}
@@ -211,10 +212,12 @@ func testBigMap(squares map[int]int, n int) {
func mapgrow() {
m := make(map[int]int)
- const (
- Delete = 500
- N = Delete * 2
- )
+ var Delete = 500
+ if unsafe.Sizeof(uintptr(0)) < 4 {
+ // Reduce the number of iterations on low-memory devices like AVR.
+ Delete = 20
+ }
+ var N = Delete * 2
for i := 0; i < Delete; i++ {
m[i] = i
@@ -246,7 +249,7 @@ func mapgrow() {
println("bad length post grow/delete", len(m))
}
- seen := make([]bool, 500)
+ seen := make([]bool, Delete)
var mcount int
for k, v := range m {