PageRenderTime 42ms CodeModel.GetById 29ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

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

#
Go | 62 lines | 40 code | 15 blank | 7 comment | 22 complexity | 5bd6fdb03927d97a9d0c29a6a94a6d61 MD5 | raw file
 1package main
 2
 3import . "./overload_complicated"
 4
 5func main() {
 6	var pInt *int
 7
 8	// Check the correct constructors are available
 9	p := NewPop(pInt)
10
11	p = NewPop(pInt, false)
12
13	// Check overloaded in const only and pointers/references
14	// which target languages cannot disambiguate
15	if p.Hip(false) != 701 {
16		panic("Test 1 failed")
17	}
18
19	if p.Hip(pInt) != 702 {
20		panic("Test 2 failed")
21	}
22
23	// Reverse the order for the above
24	if p.Hop(pInt) != 805 {
25		panic("Test 3 failed")
26	}
27
28	if p.Hop(false) != 801 {
29		panic("Test 4 failed")
30	}
31
32	// Few more variations and order shuffled
33	if p.Pop(false) != 901 {
34		panic("Test 5 failed")
35	}
36
37	if p.Pop(pInt) != 902 {
38		panic("Test 6 failed")
39	}
40
41	if p.Pop() != 905 {
42		panic("Test 7 failed")
43	}
44
45	// Overload on const only
46	if p.Bop(pInt) != 1001 {
47		panic("Test 8 failed")
48	}
49
50	if p.Bip(pInt) != 2001 {
51		panic("Test 9 failed")
52	}
53
54	// Globals
55	if Muzak(false) != 3001 {
56		panic("Test 10 failed")
57	}
58
59	if Muzak(pInt) != 3002 {
60		panic("Test 11 failed")
61	}
62}