summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2019-02-23 20:19:31 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2019-02-23 20:19:31 +0100
commitcc5588347f7b1efbd522c073b6a79bb6602b771f (patch)
tree329f23b5e54850da0ab88bcb8fdddd296e8af28c
parentb488cd24bb6e32aacc437a083dbdcc6b62ab3800 (diff)
downloadvala-cc5588347f7b1efbd522c073b6a79bb6602b771f.tar.gz
tests: Add "custom types" struct tests to increase coverage
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/basic-types/custom-types.vala51
2 files changed, 52 insertions, 0 deletions
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;
+ }
+}