From 993aac1d5049fff6ce16c516f6a231bc30ba189c Mon Sep 17 00:00:00 2001 From: johannes Date: Tue, 22 Oct 2024 16:49:33 +0200 Subject: [PATCH] Moved test outside CAN_SIGNED directive --- test/test_canmap.cpp | 66 +++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/test/test_canmap.cpp b/test/test_canmap.cpp index b006883..ab5ea82 100644 --- a/test/test_canmap.cpp +++ b/test/test_canmap.cpp @@ -580,6 +580,40 @@ static void fail_to_map_with_invalid_big_endian_total_struct_offset() CAN_ERR_INVALID_OFS); } + +static void create_and_delete_complex_map_once() +{ + canMap->AddSend(Param::amp, 257, 24, 8, -1.00, 0); + canMap->AddSend(Param::pot, 257, 0, 8, 1.00, 0); + canMap->AddSend(Param::pot, 257, 8, 8, -1.00, 0); + canMap->AddSend(Param::amp, 257, 16, 8, 1.00, 0); + canMap->AddSend(Param::pot, 819, 0, 8, 1.00, 0); + canMap->AddSend(Param::pot, 819, 8, 8, -1.00, 0); + canMap->AddSend(Param::amp, 819, 16, 8, 1.00, 0); + canMap->AddSend(Param::amp, 819, 24, 8, -1.00, 0); + canMap->AddSend(Param::ocurlim, 3, 23, -16, 1.00, 0); + canMap->AddSend(Param::ocurlim, 2, 8, 16, 1.00, 0); + canMap->AddSend(Param::amp, 259, 31, -16, 1.00, 0); + canMap->AddSend(Param::pot, 259, 15, -16, 1.00, 0); + int count = canMap->AddSend(Param::pot, 261, 31, -32, 1.00, 0); + ASSERT(count == 6); + + count = canMap->AddRecv(Param::ocurlim, 1, 23, -16, 1.00, 0); + ASSERT(count == 1); + + int deleted = 0; + for (int i = 0; i < 13; i++) + { + deleted += canMap->Remove(false, 0, 0); + } + ASSERT(deleted == 13); + ASSERT(canMap->Remove(false, 0, 0) == 0); + + ASSERT(canMap->Remove(true, 0, 0) == 1); + ASSERT(canMap->Remove(true, 0, 0) == 0); +} + + #if CAN_SIGNED static void receive_map_little_endian_negative_number_16_bit_in_first_word() @@ -1057,38 +1091,6 @@ static void receive_map_big_endian_large_32_bit_mostly_in_second_word() ASSERT(Param::GetInt(Param::amp) == 0x1000000); } -static void create_and_delete_complex_map_once() -{ - canMap->AddSend(Param::amp, 257, 24, 8, -1.00, 0); - canMap->AddSend(Param::pot, 257, 0, 8, 1.00, 0); - canMap->AddSend(Param::pot, 257, 8, 8, -1.00, 0); - canMap->AddSend(Param::amp, 257, 16, 8, 1.00, 0); - canMap->AddSend(Param::pot, 819, 0, 8, 1.00, 0); - canMap->AddSend(Param::pot, 819, 8, 8, -1.00, 0); - canMap->AddSend(Param::amp, 819, 16, 8, 1.00, 0); - canMap->AddSend(Param::amp, 819, 24, 8, -1.00, 0); - canMap->AddSend(Param::ocurlim, 3, 23, -16, 1.00, 0); - canMap->AddSend(Param::ocurlim, 2, 8, 16, 1.00, 0); - canMap->AddSend(Param::amp, 259, 31, -16, 1.00, 0); - canMap->AddSend(Param::pot, 259, 15, -16, 1.00, 0); - int count = canMap->AddSend(Param::pot, 261, 31, -32, 1.00, 0); - ASSERT(count == 6); - - count = canMap->AddRecv(Param::ocurlim, 1, 23, -16, 1.00, 0); - ASSERT(count == 1); - - int deleted = 0; - for (int i = 0; i < 13; i++) - { - deleted += canMap->Remove(false, 0, 0); - } - ASSERT(deleted == 13); - ASSERT(canMap->Remove(false, 0, 0) == 0); - - ASSERT(canMap->Remove(true, 0, 0) == 1); - ASSERT(canMap->Remove(true, 0, 0) == 0); -} - #define RECEIVE_TESTS \ receive_map_little_endian_12_bit_small_throttle_value, \ receive_map_little_endian_12_bit_large_throttle_value, \