From: Rico Tzschichholz Date: Sat, 23 Feb 2019 19:19:31 +0000 (+0100) Subject: tests: Add "custom types" struct tests to increase coverage X-Git-Tag: 0.43.92~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc5588347f7b1efbd522c073b6a79bb6602b771f;p=thirdparty%2Fvala.git tests: Add "custom types" struct tests to increase coverage --- 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; + } +}