summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2013-12-29 13:57:37 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2013-12-29 13:57:37 -0500
commite3bb578a0b11a25b0ae4c805fb7b98b724103b6f (patch)
treeaf3993d4b3c0bfc3d605e090d746f142970984ee /tests
parent50715d3d8783dd081a403c1e580b34177ffa57bf (diff)
Test all canutil functions and document in README.
Diffstat (limited to 'tests')
-rw-r--r--tests/write_tests.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/write_tests.c b/tests/write_tests.c
index ed555f60..8cc35e21 100644
--- a/tests/write_tests.c
+++ b/tests/write_tests.c
@@ -6,6 +6,9 @@ START_TEST (test_encode_can_signal)
{
uint64_t value = bitfield_encode_float(0, 1, 3, 1, 0);
ck_assert_int_eq(value, 0);
+
+ value = bitfield_encode_float(1, 1, 3, 1, 0);
+ ck_assert_int_eq(value, 0x1000000000000000LLU);
}
END_TEST
@@ -16,11 +19,22 @@ START_TEST (test_encode_can_signal_rounding_precision)
}
END_TEST
+START_TEST (test_encode_bool)
+{
+ uint64_t value = bitfield_encode_bool(true, 1, 3);
+ ck_assert_int_eq(value, 0x1000000000000000LLU);
+ value = bitfield_encode_bool(false, 1, 3);
+ ck_assert_int_eq(value, 0x0000000000000000LLU);
+}
+END_TEST
+// TODO test encode bool
+
Suite* canwriteSuite(void) {
Suite* s = suite_create("write");
TCase *tc_core = tcase_create("core");
tcase_add_checked_fixture(tc_core, NULL, NULL);
tcase_add_test(tc_core, test_encode_can_signal);
+ tcase_add_test(tc_core, test_encode_bool);
tcase_add_test(tc_core, test_encode_can_signal_rounding_precision);
suite_add_tcase(s, tc_core);