D-Bus: Remove extra semicolon to avoid C warning
[vala-lang.git] / tests / structs / gvalue.vala
blobc17c9d9c9fa3fb2f8c8292ac75611cb9afac1ea1
1 void test_value () {
2 Value v1 = 1;
3 assert (v1.get_int() == 1);
5 string s = "hello";
6 Value v2 = s;
7 assert (v2.get_string () == s);
10 void test_value_array () {
11 int[] iarray = {1,2,3,4,5};
12 Value[] viarray = {1,2,3,4,5};
13 assert (viarray.length == iarray.length);
14 for (int i = 0; i < viarray.length; i++) {
15 assert (viarray[i].get_int () == iarray[i]);
18 string[] sarray = { "hello", "vala", "world" };
19 Value[] vsarray = { "hello", "vala", "world" };
20 assert (vsarray.length == sarray.length);
21 for (int i = 0; i < vsarray.length; i++) {
22 assert (vsarray[i].get_string () == sarray[i]);
26 void test_nullable_value () {
27 Value? v1 = 1;
28 assert (v1.get_int() == 1);
30 string s = "hello";
31 Value? v2 = s;
32 assert (v2.get_string () == s);
35 void test_nullable_value_array () {
36 int[] iarray = {1,2,3,4,5};
37 Value?[] viarray = {1,2,3,4,5};
38 assert (viarray.length == iarray.length);
39 for (int i = 0; i < viarray.length; i++) {
40 assert (viarray[i].get_int () == iarray[i]);
43 string[] sarray = { "hello", "vala", "world" };
44 Value?[] vsarray = { "hello", "vala", "world" };
45 assert (vsarray.length == sarray.length);
46 for (int i = 0; i < vsarray.length; i++) {
47 assert (vsarray[i].get_string () == sarray[i]);
51 void take_value (Value v) {
54 bool make_bool () {
55 return true;
58 void main () {
59 test_value ();
60 test_value_array ();
61 test_nullable_value ();
62 test_nullable_value_array ();
63 take_value (make_bool ());