girparser: Fix unowned keyword in metadata types
[vala-lang.git] / tests / basic-types / floats.vala
blob3294bb924fe638299094942e29079441d223320b
1 void test_double () {
2 // declaration and initialization
3 double d = 42d;
4 assert (d == 42d);
6 // assignment
7 d = 23d;
8 assert (d == 23d);
10 // access
11 double e = d;
12 assert (e == 23d);
14 // +
15 d = 42d + 23d;
16 assert (d == 65d);
18 // -
19 d = 42d - 23d;
20 assert (d == 19d);
22 // *
23 d = 42d * 23d;
24 assert (d == 966d);
26 // /
27 d = 42d / 23d;
28 assert (d > 1.8);
29 assert (d < 1.9);
31 // equality and relational
32 d = 42d;
33 assert (d == 42d);
34 assert (d != 50d);
35 assert (d < 42.5);
36 assert (!(d < 41.5));
37 assert (d <= 42d);
38 assert (!(d <= 41.5));
39 assert (d >= 42d);
40 assert (!(d >= 42.5));
41 assert (d > 41.5);
42 assert (!(d > 42.5));
44 // to_string
45 string s = d.to_string ();
46 assert (s == "42");
48 // ensure that MIN and MAX are valid values
49 d = double.MIN;
50 assert (d == double.MIN);
51 assert (d < double.MAX);
52 d = double.MAX;
53 assert (d == double.MAX);
54 assert (d > double.MIN);
57 void main () {
58 test_double ();