[wpimath] TrapezoidProfile: Fix null pointer when calling timeLeftUntil (#7894)

This commit is contained in:
me-it-is
2025-04-25 21:58:05 -07:00
committed by GitHub
parent 92010c175f
commit 3960045663
4 changed files with 26 additions and 9 deletions

View File

@@ -234,3 +234,10 @@ TEST(TrapezoidProfileTest, TimingBeforeNegativeGoal) {
}
}
}
TEST(TrapezoidProfileTest, InitalizationOfCurrentState) {
frc::TrapezoidProfile<units::meter>::Constraints constraints{1_mps, 1_mps_sq};
frc::TrapezoidProfile<units::meter> profile{constraints};
EXPECT_NEAR_UNITS(profile.TimeLeftUntil(0_m), 0_s, 1e-10_s);
EXPECT_NEAR_UNITS(profile.TotalTime(), 0_s, 1e-10_s);
}