18
18
#include " ksp_plugin/frames.hpp"
19
19
#include " ksp_plugin/interface.hpp"
20
20
#include " ksp_plugin/plugin.hpp"
21
- #include " physics/discrete_trajectory .hpp"
21
+ #include " physics/discrete_traject0ry .hpp"
22
22
#include " serialization/ksp_plugin.pb.h"
23
23
#include " testing_utilities/is_near.hpp"
24
24
#include " testing_utilities/serialization.hpp"
@@ -40,7 +40,7 @@ using base::PullSerializer;
40
40
using base::PushDeserializer;
41
41
using ksp_plugin::Barycentric;
42
42
using ksp_plugin::Plugin;
43
- using physics::DiscreteTrajectory ;
43
+ using physics::DiscreteTraject0ry ;
44
44
using quantities::Speed;
45
45
using quantities::si::Kilo;
46
46
using testing_utilities::operator " " _⑴;
@@ -57,6 +57,7 @@ using ::testing::HasSubstr;
57
57
using ::testing::Not;
58
58
using ::testing::NotNull;
59
59
using ::testing::Pair;
60
+ using ::testing::SizeIs;
60
61
using ::testing::internal::CaptureStderr;
61
62
using ::testing::internal::GetCapturedStderr;
62
63
@@ -191,17 +192,17 @@ TEST_F(PluginCompatibilityTest, Reach) {
191
192
AllOf (HasSubstr (" pre-Galileo" ), Not (HasSubstr (" pre-Frobenius" ))));
192
193
auto const test = plugin->GetVessel (" f2d77873-4776-4809-9dfb-de9e7a0620a6" );
193
194
EXPECT_THAT (test->name (), Eq (" TEST" ));
194
- EXPECT_THAT (TTSecond (test->psychohistory (). front ().time ),
195
+ EXPECT_THAT (TTSecond (test->history ()-> front ().time ),
195
196
Eq (" 1970-08-14T08:03:18" _DateTime));
196
- EXPECT_THAT (TTSecond (test->psychohistory (). back ().time ),
197
+ EXPECT_THAT (TTSecond (test->psychohistory ()-> back ().time ),
197
198
Eq (" 1970-08-14T08:47:05" _DateTime));
198
199
EXPECT_FALSE (test->has_flight_plan ());
199
200
200
201
auto const ifnity = plugin->GetVessel (" 29142a79-7acd-47a9-a34d-f9f2a8e1b4ed" );
201
202
EXPECT_THAT (ifnity->name (), Eq (" IFNITY-5.2" ));
202
- EXPECT_THAT (TTSecond (ifnity->psychohistory (). front ().time ),
203
+ EXPECT_THAT (TTSecond (ifnity->history ()-> front ().time ),
203
204
Eq (" 1970-08-14T08:03:46" _DateTime));
204
- EXPECT_THAT (TTSecond (ifnity->psychohistory (). back ().time ),
205
+ EXPECT_THAT (TTSecond (ifnity->psychohistory ()-> back ().time ),
205
206
Eq (" 1970-08-14T08:47:05" _DateTime));
206
207
ASSERT_TRUE (ifnity->has_flight_plan ());
207
208
EXPECT_THAT (ifnity->flight_plan ().number_of_man œuvres (), Eq (16 ));
@@ -262,11 +263,11 @@ TEST_F(PluginCompatibilityTest, DISABLED_Butcher) {
262
263
/* compressor=*/ " gipfeli" ,
263
264
/* decoder=*/ " base64" );
264
265
EXPECT_THAT (log_warning.string (),
265
- AllOf (HasSubstr (" pre-Haar" ), Not (HasSubstr (" pre-Gröbner" ))));
266
+ AllOf (HasSubstr (" pre-Haar" ), Not (HasSubstr (u8 " pre-Gröbner" ))));
266
267
auto const & orbiter =
267
268
*plugin->GetVessel (" e180ca12-492f-45bf-a194-4c5255aec8a0" );
268
269
EXPECT_THAT (orbiter.name (), Eq (" Mercury Orbiter 1" ));
269
- auto const begin = orbiter.psychohistory (). begin ();
270
+ auto const begin = orbiter.history ()-> begin ();
270
271
EXPECT_THAT (begin->time ,
271
272
Eq (" 1966-05-10T00:14:03" _TT + 0.0879862308502197 * Second));
272
273
EXPECT_THAT (begin->degrees_of_freedom ,
@@ -308,7 +309,7 @@ TEST_F(PluginCompatibilityTest, DISABLED_Butcher) {
308
309
-7.76112133789062500e+03 * (Metre / Second)}))));
309
310
310
311
// We arrive in late August. Check the state in the beginning of September.
311
- auto const it = orbiter.psychohistory ().LowerBound (" 1966-09-01T00:00:00" _TT);
312
+ auto const it = orbiter.trajectory ().lower_bound (" 1966-09-01T00:00:00" _TT);
312
313
EXPECT_THAT (it->time , Eq (MercuryOrbiterInitialTime));
313
314
EXPECT_THAT (it->degrees_of_freedom ,
314
315
Eq (MercuryOrbiterInitialDegreesOfFreedom<Barycentric>));
@@ -326,19 +327,16 @@ TEST_F(PluginCompatibilityTest, DISABLED_Lpg) {
326
327
R"( P:\Public Mockingbird\Principia\Saves\3136\3136.proto.b64)" ,
327
328
/* compressor=*/ " gipfeli" ,
328
329
/* decoder=*/ " base64" );
329
- // TODO(phl): Check that we mention a compatibility path here once something
330
- // changes.
331
330
EXPECT_THAT (log_warning.string (),
332
- Not (HasSubstr (" pre-Haar" )));
331
+ AllOf ( HasSubstr ( u8" pre-Ζήνων " ), Not (HasSubstr (" pre-Haar" ) )));
333
332
334
333
// The vessel with the longest history.
335
334
auto const & vessel =
336
335
*plugin->GetVessel (" 77ddea45-47ee-48c0-aee9-d55cdb35ffcd" );
337
- auto & psychohistory =
338
- const_cast <DiscreteTrajectory<Barycentric>&>(vessel.psychohistory ());
339
- auto const history = psychohistory.root ();
340
- EXPECT_EQ (435'927 , history->Size ());
341
- EXPECT_EQ (435'929 , psychohistory.Size ());
336
+ auto history = vessel.history ();
337
+ auto psychohistory = vessel.psychohistory ();
338
+ EXPECT_THAT (*history, SizeIs (435'927 ));
339
+ EXPECT_THAT (*psychohistory, SizeIs (3 ));
342
340
343
341
// Evaluate a point in each of the two segments.
344
342
EXPECT_THAT (history->EvaluateDegreesOfFreedom (" 1957-10-04T19:28:34" _TT),
@@ -351,7 +349,7 @@ TEST_F(PluginCompatibilityTest, DISABLED_Lpg) {
351
349
{-6.28845231836519179e+03 * (Metre / Second),
352
350
+2.34046542233168329e+04 * (Metre / Second),
353
351
+4.64410011408655919e+03 * (Metre / Second)}))));
354
- EXPECT_THAT (psychohistory. EvaluateDegreesOfFreedom (" 1958-10-07T09:38:30" _TT),
352
+ EXPECT_THAT (psychohistory-> EvaluateDegreesOfFreedom (" 1958-10-07T09:38:30" _TT),
355
353
Eq (DegreesOfFreedom<Barycentric>(
356
354
Barycentric::origin + Displacement<Barycentric>(
357
355
{+1.45814173315801941e+11 * Metre,
@@ -365,7 +363,8 @@ TEST_F(PluginCompatibilityTest, DISABLED_Lpg) {
365
363
// Serialize the history and psychohistory to a temporary file.
366
364
{
367
365
serialization::DiscreteTrajectory message;
368
- history->WriteToMessage (&message, /* forks=*/ {&psychohistory}, /* exact=*/ {});
366
+ vessel.trajectory ().WriteToMessage (
367
+ &message, /* tracked=*/ {history, psychohistory}, /* exact=*/ {});
369
368
auto const serialized_message = base::SerializeAsBytes (message);
370
369
WriteToBinaryFile (TEMP_DIR / " trajectory_3136.proto.bin" ,
371
370
serialized_message.get ());
@@ -377,11 +376,10 @@ TEST_F(PluginCompatibilityTest, DISABLED_Lpg) {
377
376
ReadFromBinaryFile (TEMP_DIR / " trajectory_3136.proto.bin" );
378
377
auto const message =
379
378
ParseFromBytes<serialization::DiscreteTrajectory>(serialized_message);
380
- DiscreteTrajectory<Barycentric>* psychohistory = nullptr ;
381
- auto const history = DiscreteTrajectory<Barycentric>::ReadFromMessage (
382
- message, /* forks=*/ {&psychohistory});
383
- EXPECT_EQ (435'927 , history->Size ());
384
- EXPECT_EQ (435'929 , psychohistory->Size ());
379
+ auto const trajectory = DiscreteTraject0ry<Barycentric>::ReadFromMessage (
380
+ message, /* tracked=*/ {&history, &psychohistory});
381
+ EXPECT_THAT (*history, SizeIs (435'927 ));
382
+ EXPECT_THAT (*psychohistory, SizeIs (3 ));
385
383
}
386
384
387
385
// Make sure that we can upgrade, save, and reload.
0 commit comments