OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.go-torture/] [execute/] [map-1.go] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 698 jeremybenn
package main
2
 
3
func main() {
4
  v := make(map[int] int);
5
  v[0] = 0;
6
  v[1000000] = 1;
7
  if v[0] != 0 {
8
    panic(1)
9
  }
10
  val, present := v[0];
11
  if !present || val != 0 {
12
    panic(2)
13
  }
14
  val = 5;
15
  val, present = v[1];
16
  if present || val != 0 {
17
    panic(3);
18
  }
19
  if v[2] != 0 {
20
    panic(4)
21
  }
22
  val, present = v[2];
23
  if present {
24
    panic(5)
25
  }
26
  if len(v) != 2 {
27
    panic(6)
28
  }
29
  v[0] = 0, false;
30
  if len(v) != 1 {
31
    panic(7)
32
  }
33
 
34
  w := make(map[string] string);
35
  if len(w) != 0 {
36
    panic(8)
37
  }
38
  w["Hello"] = "world";
39
  w["Goodbye"] = "sweet prince";
40
  if w["Hello"] != "world" {
41
    panic(9)
42
  }
43
  if w["Hej"] != "" {
44
    panic(10)
45
  }
46
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.