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



commit cc5588347f7b1efbd522c073b6a79bb6602b771f
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 676da7ea8..b8288288e 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/arrays-fixed-assignment.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]