]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "custom types" struct tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 23 Feb 2019 19:19:31 +0000 (20:19 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 23 Feb 2019 19:19:31 +0000 (20:19 +0100)
tests/Makefile.am
tests/basic-types/custom-types.vala [new file with mode: 0644]

index 676da7ea89e0c9f47d27add9be1a84bae1e557b3..b8288288e824c21ff1df8828a54d826a61c243b4 100644 (file)
@@ -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 (file)
index 0000000..d979a9b
--- /dev/null
@@ -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;
+       }
+}