aboutsummaryrefslogtreecommitdiff
path: root/core/tests/unop.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/tests/unop.c')
-rw-r--r--core/tests/unop.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/tests/unop.c b/core/tests/unop.c
new file mode 100644
index 0000000..a63e420
--- /dev/null
+++ b/core/tests/unop.c
@@ -0,0 +1,24 @@
+#include <tri.h>
+
+int main()
+{
+ /* technically speaking there are only 27 cases to test, and they could
+ * potentially all checked for manually, but this is good enough for now
+ */
+ tri_t t = tri_parse_default("i01", 3);
+
+ tri_t r = tri_unop(NOP, t);
+ assert(tri_eq(r, t));
+
+ r = tri_unop(NNN, t);
+ assert(tri_eq(r, tri_from(TRI_MIN)));
+
+ r = tri_unop(OOO, t);
+ assert(tri_eq(r, tri_from(0)));
+
+ r = tri_unop(PPP, t);
+ assert(tri_eq(r, tri_from(TRI_MAX)));
+
+ r = tri_unop(PON, t);
+ assert(tri_eq(r, tri_parse_default("10i", 3)));
+}