PageRenderTime 16ms CodeModel.GetById 1ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Examples/test-suite/python/li_std_map_runme.py

#
Python | 58 lines | 34 code | 24 blank | 0 comment | 11 complexity | 4b5c67a4db2ab34cc44bc12c2371e3d3 MD5 | raw file
 1import li_std_map
 2
 3a1 = li_std_map.A(3)
 4a2 = li_std_map.A(7)
 5
 6
 7p0 = li_std_map.pairii(1,2)
 8p1 = li_std_map.pairA(1,a1.this)
 9m = {}
10m[1] = a1
11m[2] = a2
12
13pp1 = li_std_map.p_identa(p1)
14mm = li_std_map.m_identa(m)
15
16
17
18m = li_std_map.mapA()
19m[1] = a1
20m[2] = a2
21
22
23pm ={}
24for k in m:
25  pm[k] = m[k]
26
27for k in m:  
28  if pm[k].this != m[k].this:
29    print pm[k], m[k]
30    raise RuntimeError
31
32  
33
34
35
36m = {}
37m[1] = (1,2)
38m["foo"] = "hello"
39
40pm = li_std_map.pymap()
41
42for k in m:  
43  pm[k] = m[k]
44
45for k in pm:  
46  if (pm[k] != m[k]):
47    raise RuntimeError
48
49
50
51mii = li_std_map.IntIntMap()
52
53mii[1] = 1
54mii[1] = 2
55
56if mii[1] != 2:
57  raise RuntimeError
58