fix(leg_profile): ignore tuned tape keys when tape_enabled is false instead of rejecting the profile
This commit is contained in:
@@ -184,7 +184,7 @@ TEST(LegProfile, ValidatesAllBrightBiasThreshold)
|
||||
EXPECT_FALSE(p.validate(error));
|
||||
}
|
||||
p.tape_range_bias_all_max_std = 0.02;
|
||||
EXPECT_FALSE(p.validate(error));
|
||||
EXPECT_TRUE(p.validate(error)) << error;
|
||||
p.tape_enabled = true;
|
||||
EXPECT_FALSE(p.validate(error));
|
||||
p.tape_range_bias_sigma = 0.05;
|
||||
@@ -869,12 +869,12 @@ TEST(LegProfile, ValidateRefusesBrokenProfiles)
|
||||
EXPECT_FALSE(p.validate(error));
|
||||
}
|
||||
|
||||
TEST(LegProfile, TapeBloomAndRangeBiasRequireTapeAndValidRanges)
|
||||
TEST(LegProfile, TapeBloomAndRangeBiasRequireValidRanges)
|
||||
{
|
||||
std::string error;
|
||||
LegProfile p = tciTrolley();
|
||||
p.tape_bloom_max_angle = 0.10;
|
||||
EXPECT_FALSE(p.validate(error));
|
||||
EXPECT_TRUE(p.validate(error)) << error;
|
||||
|
||||
p = reflectiveTrolley();
|
||||
p.tape_bloom_max_angle = 0.5;
|
||||
@@ -902,7 +902,7 @@ TEST(LegProfile, TapePlateauRequiresValidFractionAndBloom)
|
||||
}
|
||||
p = tciTrolley();
|
||||
p.tape_plateau_min_fraction = 0.65;
|
||||
EXPECT_FALSE(p.validate(error));
|
||||
EXPECT_TRUE(p.validate(error)) << error;
|
||||
p = reflectiveTrolley();
|
||||
p.tape_bloom_max_angle = 0.0;
|
||||
p.tape_plateau_min_fraction = 0.65;
|
||||
@@ -916,6 +916,55 @@ TEST(LegProfile, TapePlateauRequiresValidFractionAndBloom)
|
||||
EXPECT_TRUE(p.validate(error)) << error;
|
||||
}
|
||||
|
||||
TEST(LegProfile, TapeOffIgnoresTunedKeysButStillRejectsEntryTape)
|
||||
{
|
||||
LegProfile p = tciTrolley();
|
||||
std::string error;
|
||||
EXPECT_TRUE(p.ignoredTapeKeys().empty());
|
||||
p.tape_bloom_max_angle = 0.10;
|
||||
p.tape_range_bias_sigma = 0.05;
|
||||
p.tape_plateau_min_fraction = 0.65;
|
||||
p.tape_range_bias_all_max_std = 0.02;
|
||||
ASSERT_TRUE(p.validate(error)) << error;
|
||||
EXPECT_EQ(p.ignoredTapeKeys(), "tape_bloom_max_angle 0.100, tape_range_bias_sigma 0.050, "
|
||||
"tape_plateau_min_fraction 0.650, tape_range_bias_all_max_std 0.020");
|
||||
p.tape_enabled = true;
|
||||
EXPECT_TRUE(p.validate(error)) << error;
|
||||
EXPECT_TRUE(p.ignoredTapeKeys().empty());
|
||||
p.tape_enabled = false;
|
||||
p.tape_legs = TapeLegs::kEntry;
|
||||
EXPECT_FALSE(p.validate(error));
|
||||
EXPECT_EQ(error, "tape_legs 'entry' requires tape_enabled: true (forgot to turn the tape on?)");
|
||||
p.tape_legs = TapeLegs::kAll;
|
||||
p.tape_bloom_max_angle = 0.0;
|
||||
p.tape_plateau_min_fraction = 0.0;
|
||||
p.tape_range_bias_all_max_std = 0.0;
|
||||
EXPECT_EQ(p.ignoredTapeKeys(), "tape_range_bias_sigma 0.050");
|
||||
}
|
||||
|
||||
TEST(LegProfile, TapeKeyRangesAreCheckedEvenWhenTapeIsOff)
|
||||
{
|
||||
std::string error;
|
||||
const double nan = std::numeric_limits<double>::quiet_NaN();
|
||||
const double inf = std::numeric_limits<double>::infinity();
|
||||
for (bool enabled : { false, true })
|
||||
{
|
||||
for (const auto& test : { std::pair<double LegProfile::*, double>{ &LegProfile::tape_bloom_max_angle, 0.5 },
|
||||
{ &LegProfile::tape_range_bias_sigma, 0.201 },
|
||||
{ &LegProfile::tape_plateau_min_fraction, 1.0 },
|
||||
{ &LegProfile::tape_range_bias_all_max_std, 0.101 } })
|
||||
{
|
||||
for (double value : { -0.01, test.second, nan, inf })
|
||||
{
|
||||
LegProfile p = tciTrolley();
|
||||
p.tape_enabled = enabled;
|
||||
p.*test.first = value;
|
||||
EXPECT_FALSE(p.validate(error)) << "tape_enabled=" << enabled << ", value=" << value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(LegPatternMatcher, PlateauRescuesEdgeRampButRejectsSlopeAndShortPlateau)
|
||||
{
|
||||
LegProfile p = reflectiveTrolley();
|
||||
|
||||
Reference in New Issue
Block a user