Skip to content
Snippets Groups Projects
Commit 561eedf0 authored by Aron Leibfried's avatar Aron Leibfried
Browse files

Add test names for bitformatting and helper test

Change-Id: Id27a5ff2b03f7ec67d39e0acd12ed8b0802ed59c
parent 02f816f8
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,8 @@ using namespace libnux::vx;
void test_reverse_byte()
{
testcase_begin(__func__);
uint8_t byte_1 = 170;
test_equal(reverse_byte(byte_1), 85);
......@@ -13,10 +15,14 @@ void test_reverse_byte()
uint8_t byte_3 = 0;
test_equal(reverse_byte(byte_3), 0);
testcase_end();
}
void test_vector_reverse_bytes()
{
testcase_begin(__func__);
__vector uint8_t test_vector;
for (uint8_t i = 0; i < sizeof(__vector uint8_t); i++) {
......@@ -28,6 +34,8 @@ void test_vector_reverse_bytes()
for (uint8_t i = 0; i < sizeof(__vector uint8_t); i++) {
test_equal(test_vector[i], reverse_byte(i));
}
testcase_end();
}
void start()
......
......@@ -7,6 +7,8 @@ using namespace libnux::vx;
void test_abs_diff()
{
testcase_begin(__func__);
uint8_t u8bit_1 = 150;
uint8_t u8bit_2 = 15;
test_equal(abs_diff(u8bit_1, u8bit_2), static_cast<uint8_t>(135));
......@@ -26,15 +28,21 @@ void test_abs_diff()
int16_t s16bit_1 = -1000;
int16_t s16bit_2 = -100;
test_equal(abs_diff(s16bit_1, s16bit_2), static_cast<int16_t>(900));
testcase_end();
}
void test_find_max_amount()
{
testcase_begin(__func__);
std::array<uint8_t, 10> array_1{4, 17, 193, 4, 193, 10, 5, 3, 4, 0};
test_equal(find_max_amount(array_1), static_cast<uint8_t>(4));
std::array<uint16_t, 5> array_2{1600, 300, 1600, 300, 1600};
test_equal(find_max_amount(array_2), static_cast<uint16_t>(1600));
testcase_end();
}
void start()
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment