test etb rounding

This commit is contained in:
Matthew Kennedy 2024-03-14 15:49:38 -07:00
parent 4a8d6c5b96
commit e2fa08478e
1 changed files with 3 additions and 2 deletions

View File

@ -807,10 +807,11 @@ TEST(etb, openLoopThrottle) {
setLinearCurve(config->etbBiasBins, 0, 100); setLinearCurve(config->etbBiasBins, 0, 100);
setLinearCurve(config->etbBiasValues, -50, 50); setLinearCurve(config->etbBiasValues, -50, 50);
// due to rounding (scaled integer table storage) some of these values are funny
EXPECT_NEAR(-50, etb.getOpenLoop(0).value_or(-1), EPS4D); EXPECT_NEAR(-50, etb.getOpenLoop(0).value_or(-1), EPS4D);
EXPECT_NEAR(-25, etb.getOpenLoop(25).value_or(-1), EPS4D); EXPECT_NEAR(-24.975, etb.getOpenLoop(25).value_or(-1), EPS4D);
EXPECT_NEAR(0, etb.getOpenLoop(50).value_or(-1), EPS4D); EXPECT_NEAR(0, etb.getOpenLoop(50).value_or(-1), EPS4D);
EXPECT_NEAR(25, etb.getOpenLoop(75).value_or(-1), EPS4D); EXPECT_NEAR(24.975, etb.getOpenLoop(75).value_or(-1), EPS4D);
EXPECT_NEAR(50, etb.getOpenLoop(100).value_or(-1), EPS4D); EXPECT_NEAR(50, etb.getOpenLoop(100).value_or(-1), EPS4D);
} }