mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 20:43:40 +00:00
avr: enable testdata/map.go
The test needs a few changes to support low-memory devices but other than that, it works fine.
This commit is contained in:
committed by
Ron Evans
parent
109b5298c4
commit
995e815b63
@@ -194,10 +194,6 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
|
||||
// Breaks interp.
|
||||
continue
|
||||
|
||||
case "map.go":
|
||||
// Reflect size calculation crashes.
|
||||
continue
|
||||
|
||||
case "channel.go":
|
||||
// Freezes after recv from closed channel.
|
||||
continue
|
||||
|
||||
Vendored
+8
-5
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user