aboutsummaryrefslogtreecommitdiffstats
path: root/libs/bitfield-c/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libs/bitfield-c/tests')
-rw-r--r--libs/bitfield-c/tests/8byte_tests.c8
-rw-r--r--libs/bitfield-c/tests/bitfield_tests.c30
-rw-r--r--libs/bitfield-c/tests/read_tests.c2
-rw-r--r--libs/bitfield-c/tests/write_tests.c4
4 files changed, 22 insertions, 22 deletions
diff --git a/libs/bitfield-c/tests/8byte_tests.c b/libs/bitfield-c/tests/8byte_tests.c
index 64554acc..ccb49cd9 100644
--- a/libs/bitfield-c/tests/8byte_tests.c
+++ b/libs/bitfield-c/tests/8byte_tests.c
@@ -173,8 +173,8 @@ END_TEST
START_TEST(test_eightbyte_get_byte)
{
uint64_t data = 0x00000000F34DFCFF;
- uint8_t result = eightbyte_get_byte(data, 0, false);
- uint8_t expected = 0x0;
+ unsigned int result = eightbyte_get_byte(data, 0, false);
+ unsigned int expected = 0x0;
ck_assert_int_eq(result, expected);
result = eightbyte_get_byte(data, 4, false);
@@ -198,8 +198,8 @@ END_TEST
START_TEST(test_eightbyte_get_nibble)
{
uint64_t data = 0x00000000F34DFCFF;
- uint8_t result = eightbyte_get_nibble(data, 0, false);
- uint8_t expected = 0x0;
+ unsigned int result = eightbyte_get_nibble(data, 0, false);
+ unsigned int expected = 0x0;
ck_assert_int_eq(result, expected);
result = eightbyte_get_nibble(data, 2, false);
diff --git a/libs/bitfield-c/tests/bitfield_tests.c b/libs/bitfield-c/tests/bitfield_tests.c
index b8c83b59..1e61dae5 100644
--- a/libs/bitfield-c/tests/bitfield_tests.c
+++ b/libs/bitfield-c/tests/bitfield_tests.c
@@ -4,8 +4,8 @@
START_TEST (test_get_byte)
{
- uint8_t data[4] = {0x12, 0x34, 0x56, 0x78};
- uint8_t result = get_byte(data, sizeof(data), 0);
+ unsigned int data[4] = {0x12, 0x34, 0x56, 0x78};
+ unsigned int result = get_byte(data, sizeof(data), 0);
ck_assert_int_eq(result, 0x12);
result = get_byte(data, sizeof(data), 3);
ck_assert_int_eq(result, 0x78);
@@ -14,7 +14,7 @@ END_TEST
START_TEST (test_set_nibble)
{
- uint8_t data[4] = {0};
+ unsigned int data[4] = {0};
fail_unless(set_nibble(0, 0x1, data, sizeof(data)));
fail_unless(set_nibble(1, 0x2, data, sizeof(data)));
fail_unless(set_nibble(2, 0x3, data, sizeof(data)));
@@ -28,7 +28,7 @@ END_TEST
START_TEST (test_set_bitfield)
{
- uint8_t data[4] = {0};
+ unsigned int data[4] = {0};
fail_unless(set_bitfield(0x12, 0, 8, data, sizeof(data)));
fail_unless(set_bitfield(bitmask(3), 10, 3, data, sizeof(data)));
ck_assert_int_eq(data[0], 0x12);
@@ -38,7 +38,7 @@ END_TEST
START_TEST (test_set_bitfield_doesnt_fit)
{
- uint8_t data[4] = {0};
+ unsigned int data[4] = {0};
fail_if(set_bitfield(0xffff, 0, 8, data, sizeof(data)));
ck_assert_int_eq(data[0], 0);
ck_assert_int_eq(data[1], 0);
@@ -49,8 +49,8 @@ END_TEST
START_TEST (test_get_nibble)
{
- uint8_t data[4] = {0x12, 0x34, 0x56, 0x78};
- uint8_t result = get_nibble(data, sizeof(data), 0);
+ unsigned int data[4] = {0x12, 0x34, 0x56, 0x78};
+ unsigned int result = get_nibble(data, sizeof(data), 0);
ck_assert_int_eq(result, 0x1);
result = get_nibble(data, sizeof(data), 1);
ck_assert_int_eq(result, 0x2);
@@ -61,8 +61,8 @@ END_TEST
START_TEST (test_get_bits_out_of_range)
{
- uint8_t data[4] = {0x12, 0x34, 0x56, 0x78};
- uint8_t result[4];
+ unsigned int data[4] = {0x12, 0x34, 0x56, 0x78};
+ unsigned int result[4];
fail_if(copy_bits_right_aligned(data, sizeof(data), 25, 16, result,
sizeof(result)));
}
@@ -70,8 +70,8 @@ END_TEST
START_TEST (test_get_bits)
{
- uint8_t data[4] = {0x12, 0x34, 0x56, 0x78};
- uint8_t result[4] = {0};
+ unsigned int data[4] = {0x12, 0x34, 0x56, 0x78};
+ unsigned int result[4] = {0};
fail_unless(copy_bits_right_aligned(data, sizeof(data), 0, 16, result,
sizeof(result)));
ck_assert_int_eq(result[2], 0x12);
@@ -81,8 +81,8 @@ END_TEST
START_TEST (test_copy_bytes)
{
- uint8_t data[4] = {0x12, 0x34, 0x56, 0x78};
- uint8_t result[4] = {0};
+ unsigned int data[4] = {0x12, 0x34, 0x56, 0x78};
+ unsigned int result[4] = {0};
fail_unless(copy_bytes_right_aligned(data, sizeof(data), 1, 3, result,
sizeof(result)));
ck_assert_int_eq(result[1], 0x34);
@@ -93,8 +93,8 @@ END_TEST
START_TEST (test_get_uneven_bits)
{
- uint8_t data[4] = {0x12, 0x34, 0x56, 0x78};
- uint8_t result[4] = {0};
+ unsigned int data[4] = {0x12, 0x34, 0x56, 0x78};
+ unsigned int result[4] = {0};
fail_unless(copy_bits_right_aligned(data, sizeof(data), 4, 12, result,
sizeof(result)));
ck_assert_int_eq(result[2], 0x2);
diff --git a/libs/bitfield-c/tests/read_tests.c b/libs/bitfield-c/tests/read_tests.c
index 5008cc52..192a0fe0 100644
--- a/libs/bitfield-c/tests/read_tests.c
+++ b/libs/bitfield-c/tests/read_tests.c
@@ -3,7 +3,7 @@
#include <canutil/read.h>
const uint64_t BIG_ENDIAN_TEST_DATA = __builtin_bswap64(0xEB00000000000000);
-const uint8_t ARRAY_TEST_DATA[] = {0xEB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
+const unsigned int ARRAY_TEST_DATA[] = {0xEB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
START_TEST (test_eightbyte_parse_float)
{
diff --git a/libs/bitfield-c/tests/write_tests.c b/libs/bitfield-c/tests/write_tests.c
index 4d5d8fc3..9e65b9d0 100644
--- a/libs/bitfield-c/tests/write_tests.c
+++ b/libs/bitfield-c/tests/write_tests.c
@@ -30,7 +30,7 @@ END_TEST
START_TEST (test_bitfield_encode_float)
{
- uint8_t data[8] = {0};
+ unsigned int data[8] = {0};
bitfield_encode_float(0, 1, 3, 1, 0, data, sizeof(data));
ck_assert_int_eq(data[0], 0);
ck_assert_int_eq(data[1], 0);
@@ -55,7 +55,7 @@ END_TEST
START_TEST (test_bitfield_encode_bool)
{
- uint8_t data[8] = {0};
+ unsigned int data[8] = {0};
bitfield_encode_bool(true, 1, 3, data, sizeof(data));
ck_assert_int_eq(data[0], 0x10);
ck_assert_int_eq(data[1], 0);