[vala/0.42] tests: Add "custom types" struct tests to increase coverage



commit 72fa59919ee31970d1cbbc3dbd40f3841ad6ced6
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Feb 23 20:19:31 2019 +0100

    tests: Add "custom types" struct tests to increase coverage

 tests/Makefile.am                   |  1 +
 tests/basic-types/custom-types.vala | 51 +++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5b086983e..439f12ec7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -23,6 +23,7 @@ TESTS = \
        basic-types/integers.vala \
        basic-types/escape-chars.vala \
        basic-types/floats.vala \
+       basic-types/custom-types.vala \
        basic-types/strings.vala \
        basic-types/arrays.vala \
        basic-types/array-uint8-uchar-compat.vala \
diff --git a/tests/basic-types/custom-types.vala b/tests/basic-types/custom-types.vala
new file mode 100644
index 000000000..d979a9beb
--- /dev/null
+++ b/tests/basic-types/custom-types.vala
@@ -0,0 +1,51 @@
+[IntegerType (rank = 6, signed = true, width = 32)]
+[SimpleType]
+[CCode (has_type_id = false)]
+struct foo_t {
+}
+
+[IntegerType (rank = 11, signed = false, width = 64)]
+[SimpleType]
+[CCode (has_type_id = false)]
+struct faz_t {
+}
+
+[FloatingType (rank = 1, width = 32)]
+[SimpleType]
+[CCode (has_type_id = false)]
+struct bar_t {
+}
+
+[FloatingType (rank = 2, width = 64)]
+[SimpleType]
+[CCode (has_type_id = false)]
+struct baz_t {
+}
+
+[BooleanType]
+[SimpleType]
+[CCode (has_type_id = false)]
+struct manam_t {
+}
+
+void main () {
+       {
+               foo_t foo = int32.MAX;
+               assert (foo == int32.MAX);
+       }
+       {
+               faz_t faz = uint64.MAX;
+               assert (faz == uint64.MAX);
+       }
+       {
+               bar_t bar = float.MAX;
+               assert (bar == float.MAX);
+       }
+       {
+               baz_t baz = double.MAX;
+               assert (baz == double.MAX);
+       }
+       {
+               manam_t manam;
+       }
+}


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