diff options
author | Russ Cox <rsc@golang.org> | 2008-12-19 03:05:37 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2008-12-19 03:05:37 -0800 |
commit | 02431bc144fd0ee3cea7ee8a47a28eebcf7bebbe (patch) | |
tree | 183e8cd345f5f895d2cbc36dd8f8be93640303c3 /test/map.go | |
parent | 803b4ce450fdc923110e0526fbc3aeb2ad07cc63 (diff) | |
download | go-02431bc144fd0ee3cea7ee8a47a28eebcf7bebbe.tar.gz |
change *map to map; *chan to chan; new(T) to new(*T)
fix bugs left over from *[] to [] conversion.
TBR=r
OCL=21576
CL=21581
Diffstat (limited to 'test/map.go')
-rw-r--r-- | test/map.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/map.go b/test/map.go index a0175feac..7182aa08f 100644 --- a/test/map.go +++ b/test/map.go @@ -46,8 +46,8 @@ func main() { //mit := new(map[int] T); // should be able to do a value but: fatal error: algtype: cant find type <T>{} //mti := new(map[T] int); // should be able to do a value but: fatal error: algtype: cant find type <T>{} - type M map[int] int; - mipM := new(map[int] *M); + type M map[int] int; + mipM := new(map[int] M); const count = 100; // BUG: should be bigger but maps do linear lookup var apT [2*count]*T; @@ -55,14 +55,14 @@ func main() { for i := 0; i < count; i++ { s := F.d(i).str(); f := float(i); - apT[i] = new(T); + apT[i] = new(*T); apT[i].s = s; apT[i].f = f; - apT[2*i] = new(T); // need twice as many entries as we use, for the nonexistence check + apT[2*i] = new(*T); // need twice as many entries as we use, for the nonexistence check apT[2*i].s = s; apT[2*i].f = f; // BUG t := T(s, f); - t := new(T); t.s = s; t.f = f; + t := new(*T); t.s = s; t.f = f; // BUG m := M(i, i+1); m := new(M); m[i] = i+1; mib[i] = (i != 0); @@ -73,7 +73,7 @@ func main() { msi[F.d(i).str()] = i; mss[F.d(i).str()] = F.d(10*i).str(); mss[F.d(i).str()] = F.d(10*i).str(); - as := new([arraylen]string); + as := new([]string, arraylen); as[0] = F.d(10*i).str(); as[1] = F.d(10*i).str(); mspa[F.d(i).str()] = as; @@ -120,7 +120,7 @@ func main() { if len(mipM) != count { F.s("len(mipM) = ").d(len(mipM)).putnl(); } - + // test construction directly for i := 0; i < count; i++ { s := F.d(i).str(); @@ -411,7 +411,7 @@ func main() { } } } - + // tests for structured map element updates for i := 0; i < count; i++ { |