diff --git a/libraries/AP_Common/tests/test_bitmask.cpp b/libraries/AP_Common/tests/test_bitmask.cpp index 49d2f57cf52f43..2a19431ea030af 100644 --- a/libraries/AP_Common/tests/test_bitmask.cpp +++ b/libraries/AP_Common/tests/test_bitmask.cpp @@ -53,6 +53,12 @@ void bitmask_tests(void) EXPECT_EXIT(x.set(N+1), testing::KilledBySignal(SIGABRT), "AP_InternalError::error_t::bitmask_range"); #endif +#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX + x.clear(N+1); +#elif CONFIG_HAL_BOARD == HAL_BOARD_SITL + EXPECT_EXIT(x.clear(N+1), testing::KilledBySignal(SIGABRT), "AP_InternalError::error_t::bitmask_range"); +#endif + for (uint8_t i=0; i x; EXPECT_EQ(-1, x.first_set()); EXPECT_EQ(false, x.get(N-4)); + EXPECT_EQ(0, x.count()); x.setall(); EXPECT_EQ(0, x.first_set()); + EXPECT_EQ(N, x.count()); x.clear(0); EXPECT_EQ(1, x.first_set()); x.clear(1); @@ -93,6 +101,7 @@ void bitmask_setall(void) EXPECT_EQ(-1, x.first_set()); EXPECT_EQ(false, x.get(N-4)); EXPECT_EQ(true, x.empty()); + EXPECT_EQ(0, x.count()); } TEST(Bitmask, SetAll31) { bitmask_setall<31>(); } @@ -116,6 +125,7 @@ void bitmask_assignment(void) Bitmask y; y = x; + EXPECT_EQ(true, x == y); x.clear(0); EXPECT_EQ(true, y.get(0)); EXPECT_EQ(true, y.get(5));