fix: 将 enum class 类型的 CHECK_EQ 改为 CHECK(==),避免 ostream<< 模板错误

This commit is contained in:
Huamonarch 2026-05-15 15:40:24 +08:00
parent 5a026accaf
commit dc26b6a7dd

View File

@ -268,7 +268,7 @@ TEST(bound_checker_detects_out_of_lower) {
TEST(bound_checker_only_right_mode_sentinel) { TEST(bound_checker_only_right_mode_sentinel) {
BoundChecker bc; BoundChecker bc;
bc.setLimits(-32768.0, 100.0); // -32768 = no lower bound bc.setLimits(-32768.0, 100.0); // -32768 = no lower bound
CHECK_EQ(bc.detectMode(), DetectMode::OnlyRight); CHECK(bc.detectMode() == DetectMode::OnlyRight);
CHECK_EQ(bc.isOutOfBounds(-999.0), false); // below lower is OK CHECK_EQ(bc.isOutOfBounds(-999.0), false); // below lower is OK
CHECK_EQ(bc.isOutOfBounds(150.0), true); // above upper triggers CHECK_EQ(bc.isOutOfBounds(150.0), true); // above upper triggers
} }
@ -276,7 +276,7 @@ TEST(bound_checker_only_right_mode_sentinel) {
TEST(bound_checker_only_left_mode_sentinel) { TEST(bound_checker_only_left_mode_sentinel) {
BoundChecker bc; BoundChecker bc;
bc.setLimits(10.0, 32767.0); // 32767 = no upper bound bc.setLimits(10.0, 32767.0); // 32767 = no upper bound
CHECK_EQ(bc.detectMode(), DetectMode::OnlyLeft); CHECK(bc.detectMode() == DetectMode::OnlyLeft);
CHECK_EQ(bc.isOutOfBounds(5.0), true); // below lower triggers CHECK_EQ(bc.isOutOfBounds(5.0), true); // below lower triggers
CHECK_EQ(bc.isOutOfBounds(999.0), false); // above upper is OK (sentinel) CHECK_EQ(bc.isOutOfBounds(999.0), false); // above upper is OK (sentinel)
} }
@ -284,7 +284,7 @@ TEST(bound_checker_only_left_mode_sentinel) {
TEST(bound_checker_only_left_mode_sentinel_32768) { TEST(bound_checker_only_left_mode_sentinel_32768) {
BoundChecker bc; BoundChecker bc;
bc.setLimits(10.0, 32768.0); // 32768 also = no upper bound bc.setLimits(10.0, 32768.0); // 32768 also = no upper bound
CHECK_EQ(bc.detectMode(), DetectMode::OnlyLeft); CHECK(bc.detectMode() == DetectMode::OnlyLeft);
CHECK_EQ(bc.isOutOfBounds(5.0), true); CHECK_EQ(bc.isOutOfBounds(5.0), true);
CHECK_EQ(bc.isOutOfBounds(999.0), false); CHECK_EQ(bc.isOutOfBounds(999.0), false);
} }
@ -292,7 +292,7 @@ TEST(bound_checker_only_left_mode_sentinel_32768) {
TEST(bound_checker_default_bilateral) { TEST(bound_checker_default_bilateral) {
BoundChecker bc; BoundChecker bc;
bc.setLimits(10.0, 20.0); bc.setLimits(10.0, 20.0);
CHECK_EQ(bc.detectMode(), DetectMode::Default); CHECK(bc.detectMode() == DetectMode::Default);
CHECK_EQ(bc.isOutOfBounds(5.0), true); CHECK_EQ(bc.isOutOfBounds(5.0), true);
CHECK_EQ(bc.isOutOfBounds(15.0), false); CHECK_EQ(bc.isOutOfBounds(15.0), false);
CHECK_EQ(bc.isOutOfBounds(25.0), true); CHECK_EQ(bc.isOutOfBounds(25.0), true);
@ -301,7 +301,7 @@ TEST(bound_checker_default_bilateral) {
TEST(bound_checker_error_mode) { TEST(bound_checker_error_mode) {
BoundChecker bc; BoundChecker bc;
bc.setLimits(-32768.0, -32768.0); // both sentinels bc.setLimits(-32768.0, -32768.0); // both sentinels
CHECK_EQ(bc.detectMode(), DetectMode::ErrorMode); CHECK(bc.detectMode() == DetectMode::ErrorMode);
CHECK_EQ(bc.isOutOfBounds(50.0), false); // error mode: never alarm CHECK_EQ(bc.isOutOfBounds(50.0), false); // error mode: never alarm
} }
@ -340,11 +340,11 @@ TEST(bound_checker_isValid) {
TEST(bound_checker_setDetectMode_override) { TEST(bound_checker_setDetectMode_override) {
BoundChecker bc; BoundChecker bc;
bc.setLimits(-32768.0, 100.0); bc.setLimits(-32768.0, 100.0);
CHECK_EQ(bc.detectMode(), DetectMode::OnlyRight); CHECK(bc.detectMode() == DetectMode::OnlyRight);
// manual override to Default // manual override to Default
bc.setDetectMode(DetectMode::Default); bc.setDetectMode(DetectMode::Default);
CHECK_EQ(bc.detectMode(), DetectMode::Default); CHECK(bc.detectMode() == DetectMode::Default);
// now both sides checked with sentinel values → out of lower triggers // now both sides checked with sentinel values → out of lower triggers
CHECK_EQ(bc.isOutOfBounds(-999.0), true); CHECK_EQ(bc.isOutOfBounds(-999.0), true);
} }