]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "integer/float literal" tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 28 Sep 2021 15:36:50 +0000 (17:36 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 4 Oct 2021 08:39:24 +0000 (10:39 +0200)
tests/Makefile.am
tests/basic-types/float-literals.vala [new file with mode: 0644]
tests/basic-types/integer-literals.vala [new file with mode: 0644]

index 07b617fe37cfc2a934dd1c9ead0225a163836290..9114ea972f5357cb4b0dd2c26fec391368d1ad27 100644 (file)
@@ -39,9 +39,11 @@ AM_TESTS_ENVIRONMENT = \
 
 TESTS = \
        basic-types/gassert.vala \
+       basic-types/integer-literals.vala \
        basic-types/integers.vala \
        basic-types/integers-boxed-cast.vala \
        basic-types/escape-chars.vala \
+       basic-types/float-literals.vala \
        basic-types/floats.vala \
        basic-types/floats-boxed-cast.vala \
        basic-types/boolean.vala \
diff --git a/tests/basic-types/float-literals.vala b/tests/basic-types/float-literals.vala
new file mode 100644 (file)
index 0000000..b4bba83
--- /dev/null
@@ -0,0 +1,14 @@
+void main () {
+       {
+               float foo = 23.42F;
+               float bar = 47.11f;
+       }
+       {
+               double foo = 23.42D;
+               double bar = 47.11d;
+       }
+       {
+               double foo = 23.42;
+               double bar = 47.11;
+       }
+}
diff --git a/tests/basic-types/integer-literals.vala b/tests/basic-types/integer-literals.vala
new file mode 100644 (file)
index 0000000..60deedb
--- /dev/null
@@ -0,0 +1,26 @@
+void main () {
+       {
+               uint foo = 23U;
+               uint bar = 42u;
+       }
+       {
+               int foo = 23;
+               int bar = 42;
+       }
+       {
+               ulong foo = 23UL;
+               ulong bar = 42ul;
+       }
+       {
+               long foo = 23L;
+               long bar = 42l;
+       }
+       {
+               uint64 foo = 23ULL;
+               uint64 bar = 42ull;
+       }
+       {
+               int64 foo = 23LL;
+               int64 bar = 42ll;
+       }
+}