[vala/staging] tests: Extend "float and integer" tests to increase coverage



commit a148cc6c42d92001a965a7b7272973502c49b1c8
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Nov 24 18:23:58 2019 +0100

    tests: Extend "float and integer" tests to increase coverage

 tests/basic-types/floats.vala   | 6 ++++++
 tests/basic-types/integers.vala | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/tests/basic-types/floats.vala b/tests/basic-types/floats.vala
index 903a4c1bf..18daf54cc 100644
--- a/tests/basic-types/floats.vala
+++ b/tests/basic-types/floats.vala
@@ -11,6 +11,12 @@ void test_double () {
        double e = d;
        assert (e == 23d);
 
+       // exponent
+       d = 1.0E-5;
+       assert (d == 0.00001);
+       d = 1.0E+4;
+       assert (d == 10000.0);
+
        // +
        d = 42d + 23d;
        assert (d == 65d);
diff --git a/tests/basic-types/integers.vala b/tests/basic-types/integers.vala
index 547120030..bd4d3036f 100644
--- a/tests/basic-types/integers.vala
+++ b/tests/basic-types/integers.vala
@@ -124,14 +124,14 @@ void test_int () {
 
        int64 i64;
        int64.try_parse ("-4711inch", out i64, out unparsed);
-       assert (i64 == -4711);
+       assert (i64 == -4711LL);
        assert (unparsed == "inch");
        int64.try_parse ("-31415km", out i64);
        assert (i64 == -31415);
 
        uint64 ui64;
        uint64.try_parse ("4711yards", out ui64, out unparsed);
-       assert (ui64 == 4711);
+       assert (ui64 == 4711ULL);
        assert (unparsed == "yards");
        uint64.try_parse ("31415yards", out ui64);
        assert (ui64 == 31415);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]