PageRenderTime 22ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Examples/test-suite/go/reference_global_vars_runme.go

#
Go | 98 lines | 76 code | 18 blank | 4 comment | 34 complexity | 8435b95ea574f82ae5429042ffa095dd MD5 | raw file
 1package main
 2
 3import . "./reference_global_vars"
 4
 5func main() {
 6	// const class reference variable
 7	if GetconstTC().GetNum() != 33 {
 8		panic(0)
 9	}
10
11	// primitive reference variables
12	SetVar_bool(Createref_bool(false))
13	if Value_bool(GetVar_bool()) != false {
14		println(1, GetVar_bool(), Value_bool(GetVar_bool()))
15		panic(0)
16	}
17
18	SetVar_bool(Createref_bool(true))
19	if Value_bool(GetVar_bool()) != true {
20		println(2, GetVar_bool(), Value_bool(GetVar_bool()))
21		panic(0)
22	}
23
24	SetVar_char(Createref_char('w'))
25	if Value_char(GetVar_char()) != 'w' {
26		println(3, GetVar_char(), Value_char(GetVar_char()))
27		panic(0)
28	}
29
30	SetVar_unsigned_char(Createref_unsigned_char(10))
31	if Value_unsigned_char(GetVar_unsigned_char()) != 10 {
32		println(4, GetVar_unsigned_char(), Value_unsigned_char(GetVar_unsigned_char()))
33		panic(0)
34	}
35
36	SetVar_signed_char(Createref_signed_char(10))
37	if Value_signed_char(GetVar_signed_char()) != 10 {
38		panic(0)
39	}
40
41	SetVar_short(Createref_short(10))
42	if Value_short(GetVar_short()) != 10 {
43		panic(0)
44	}
45
46	SetVar_unsigned_short(Createref_unsigned_short(10))
47	if Value_unsigned_short(GetVar_unsigned_short()) != 10 {
48		panic(0)
49	}
50
51	SetVar_int(Createref_int(10))
52	if Value_int(GetVar_int()) != 10 {
53		panic(0)
54	}
55
56	SetVar_unsigned_int(Createref_unsigned_int(10))
57	if Value_unsigned_int(GetVar_unsigned_int()) != 10 {
58		panic(0)
59	}
60
61	SetVar_long(Createref_long(10))
62	if Value_long(GetVar_long()) != 10 {
63		panic(0)
64	}
65
66	SetVar_unsigned_long(Createref_unsigned_long(10))
67	if Value_unsigned_long(GetVar_unsigned_long()) != 10 {
68		panic(0)
69	}
70
71	SetVar_long_long(Createref_long_long(0x6FFFFFFFFFFFFFF8))
72	if Value_long_long(GetVar_long_long()) != 0x6FFFFFFFFFFFFFF8 {
73		panic(0)
74	}
75
76	//ull = abs(0xFFFFFFF2FFFFFFF0)
77	ull := uint64(55834574864)
78	SetVar_unsigned_long_long(Createref_unsigned_long_long(ull))
79	if Value_unsigned_long_long(GetVar_unsigned_long_long()) != ull {
80		panic(0)
81	}
82
83	SetVar_float(Createref_float(10.5))
84	if Value_float(GetVar_float()) != 10.5 {
85		panic(0)
86	}
87
88	SetVar_double(Createref_double(10.5))
89	if Value_double(GetVar_double()) != 10.5 {
90		panic(0)
91	}
92
93	// class reference variable
94	SetVar_TestClass(Createref_TestClass(NewTestClass(20)))
95	if Value_TestClass(GetVar_TestClass()).GetNum() != 20 {
96		panic(0)
97	}
98}