bzr branch
http://gegoxaren.bato24.eu/bzr/vqdr/trunk
|
64
by Gustav Hartvigsson
[General] Major refactoring. Utils -> Vee nenaming. |
1 |
using Vee; |
|
50
by Gustav Hartvigsson
Added test for NamedVector |
2 |
using GLib; |
3 |
||
4 |
void named_vector_test () { |
|
|
64
by Gustav Hartvigsson
[General] Major refactoring. Utils -> Vee nenaming. |
5 |
Test.add_func (VEE_TEST_NAMED_VECTOR_PREFIX + "new", () => { |
|
50
by Gustav Hartvigsson
Added test for NamedVector |
6 |
var nv = new NamedVector<int> ("Hello,", 13, "world", 37, "!!", 69); |
|
57
by Gustav Hartvigsson
Made sure that no text rows exeed 80 columns. |
7 |
if (nv == null) { |
8 |
Test.fail (); |
|
9 |
Test.message ("`new NamedVector ()` returned a null."); |
|
10 |
} |
|
|
50
by Gustav Hartvigsson
Added test for NamedVector |
11 |
}); |
12 |
||
|
64
by Gustav Hartvigsson
[General] Major refactoring. Utils -> Vee nenaming. |
13 |
Test.add_func (VEE_TEST_NAMED_VECTOR_PREFIX + "sanity", () => { |
|
50
by Gustav Hartvigsson
Added test for NamedVector |
14 |
var nv = new NamedVector<int> ("A", 1, "B", 2, "C", 3); |
15 |
|
|
16 |
var tmp_name = nv.names[0]; |
|
17 |
if (tmp_name != "A") { |
|
18 |
Test.message ("Gotten value (%s) did not match the" + |
|
19 |
" expected value (A)", nv.names[0]); |
|
20 |
} |
|
21 |
||
22 |
tmp_name = nv.names[1]; |
|
23 |
if (tmp_name != "B") { |
|
24 |
Test.message ("Gotten value (%s) did not match the" + |
|
25 |
" expected value (B)", nv.names[0]); |
|
26 |
} |
|
27 |
|
|
28 |
tmp_name = nv.names[2]; |
|
29 |
if (tmp_name != "C") { |
|
30 |
Test.message ("Gotten value (%s) did not match the" + |
|
31 |
" expected value (C)", nv.names[0]); |
|
32 |
} |
|
33 |
||
34 |
}); |
|
35 |
||
|
64
by Gustav Hartvigsson
[General] Major refactoring. Utils -> Vee nenaming. |
36 |
Test.add_func (VEE_TEST_NAMED_VECTOR_PREFIX + "foreach", () => { |
|
50
by Gustav Hartvigsson
Added test for NamedVector |
37 |
var nv = new NamedVector<int> ("A", 1, "B", 2, "C", 3); |
38 |
||
39 |
nv.foreach ((name, val) => { |
|
40 |
message ("%s has the value: %i \n", name, val); |
|
41 |
return true; |
|
42 |
}); |
|
43 |
}); |
|
44 |
}
|