github.com/higress-group/nottinygc@v0.0.0-20231101025119-e93c4c2f8520/gc3_test.go (about) 1 // Copyright wasilibs authors 2 // SPDX-License-Identifier: MIT 3 4 package nottinygc_test 5 6 import ( 7 "strings" 8 "testing" 9 ) 10 11 // Some arbitrary stress tests. It's unclear what is a correct test for GC in practice. 12 13 func TestStress(t *testing.T) { 14 for i := 0; i < 10000; i++ { 15 a := strings.Repeat("a", 100000) 16 b := strings.Repeat("b", 100000) 17 c := strings.Repeat("c", 100000) 18 19 if strings.Count(a, "a") != 100000 { 20 t.Fatal("corrupted heap") 21 } 22 if strings.Count(b, "b") != 100000 { 23 t.Fatal("corrupted heap") 24 } 25 if strings.Count(c, "c") != 100000 { 26 t.Fatal("corrupted heap") 27 } 28 } 29 }