Skip to content

Commit

Permalink
Adding mocking for the new function.
Browse files Browse the repository at this point in the history
  • Loading branch information
pleroy committed Dec 18, 2022
1 parent 7e9c30a commit 8af84d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ksp_plugin/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ class Plugin {

// If there is a target vessel, increases the size of the prediction to try
// and cover the actual final time of the flight plan.
void ExtendPredictionForFlightPlan(GUID const& vessel_guid) const;
virtual void ExtendPredictionForFlightPlan(GUID const& vessel_guid) const;

// Computes the apsides of the trajectory defined by |begin| and |end| with
// respect to the celestial with index |celestial_index|.
Expand Down
3 changes: 3 additions & 0 deletions ksp_plugin_test/interface_flight_plan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ using quantities::si::Second;
using quantities::si::Tonne;
using testing_utilities::AlmostEquals;
using ::testing::AllOf;
using ::testing::AnyNumber;
using ::testing::ByMove;
using ::testing::DoAll;
using ::testing::Invoke;
Expand Down Expand Up @@ -147,6 +148,8 @@ TEST_F(InterfaceFlightPlanTest, FlightPlan) {
.WillRepeatedly(Return(true));
EXPECT_CALL(vessel, flight_plan())
.WillRepeatedly(ReturnRef(flight_plan));
EXPECT_CALL(*plugin_, ExtendPredictionForFlightPlan(vessel_guid))
.Times(AnyNumber());

EXPECT_TRUE(principia__FlightPlanExists(plugin_.get(), vessel_guid));

Expand Down
5 changes: 5 additions & 0 deletions ksp_plugin_test/mock_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ class MockPlugin : public Plugin {
Mass const& initial_mass),
(const, override));

MOCK_METHOD(void,
ExtendPredictionForFlightPlan,
(GUID const& vessel_guid),
(const, override));

MOCK_METHOD(void,
SetPredictionAdaptiveStepParameters,
(GUID const& vessel_guid,
Expand Down

0 comments on commit 8af84d1

Please sign in to comment.