Support constructor chain up to GObject using Object (...)
[vala-lang.git] / tests / structs / gvalue.vala
blob132af3d450aee36f6f880301e7b12f71d6736bd3
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 main () {
52 test_value ();
53 test_value_array ();
54 test_nullable_value ();
55 test_nullable_value_array ();