Skip to content

Commit

Permalink
Moved test outside CAN_SIGNED directive
Browse files Browse the repository at this point in the history
  • Loading branch information
jsphuebner committed Oct 22, 2024
1 parent cca72b7 commit 993aac1
Showing 1 changed file with 34 additions and 32 deletions.
66 changes: 34 additions & 32 deletions test/test_canmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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, \
Expand Down

0 comments on commit 993aac1

Please sign in to comment.