Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ccfb5d45f1c9
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4c5d6bc0bde1
Choose a head ref
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Aug 22, 2021

  1. read Butcher’s save

    eggrobin committed Aug 22, 2021
    Copy the full SHA
    3849a40 View commit details
  2. lint

    eggrobin committed Aug 22, 2021
    Copy the full SHA
    40ab6c6 View commit details
  3. Merge pull request #3108 from eggrobin/Лидов古在

    A diurnal test that reads Butcher’s save
    eggrobin authored Aug 22, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4c5d6bc View commit details
Showing with 84 additions and 0 deletions.
  1. +84 −0 ksp_plugin_test/plugin_compatibility_test.cpp
84 changes: 84 additions & 0 deletions ksp_plugin_test/plugin_compatibility_test.cpp
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
#include "ksp_plugin/interface.hpp"
#include "ksp_plugin/plugin.hpp"
#include "serialization/ksp_plugin.pb.h"
#include "testing_utilities/is_near.hpp"
#include "testing_utilities/serialization.hpp"

namespace principia {
@@ -30,6 +31,9 @@ using base::PullSerializer;
using base::PushDeserializer;
using ksp_plugin::Plugin;
using quantities::Speed;
using quantities::si::Kilo;
using testing_utilities::operator""_⑴;
using testing_utilities::IsNear;
using testing_utilities::ReadLinesFromBase64File;
using testing_utilities::ReadLinesFromHexadecimalFile;
using ::testing::AllOf;
@@ -274,6 +278,86 @@ TEST_F(PluginCompatibilityTest, Reach) {
}
#endif

TEST_F(PluginCompatibilityTest, DISABLED_Butcher) {
StringLogSink log_warning(google::WARNING);
not_null<std::unique_ptr<Plugin const>> plugin = ReadPluginFromFile(
R"(P:\Public Mockingbird\Principia\Saves\1119\1119.proto.b64)",
/*compressor=*/"gipfeli",
/*decoder=*/"base64");
// TODO(phl): Check that we mention a compatibility path here once something
// changes.
EXPECT_THAT(log_warning.string(),
Not(HasSubstr("pre-Gröbner")));
auto const& orbiter =
*plugin->GetVessel("e180ca12-492f-45bf-a194-4c5255aec8a0");
EXPECT_THAT(orbiter.name(), Eq("Mercury Orbiter 1"));
auto const begin = orbiter.psychohistory().begin();
EXPECT_THAT(begin->time,
Eq("1966-05-10T00:14:03"_TT + 0.0879862308502197 * Second));
EXPECT_THAT(begin->degrees_of_freedom,
Eq(DegreesOfFreedom<Barycentric>(
Barycentric::origin + Displacement<Barycentric>(
{-9.83735958466250000e+10 * Metre,
-1.05659916408781250e+11 * Metre,
-4.58171358797500000e+10 * Metre}),
Velocity<Barycentric>(
{+2.18567382812500000e+04 * (Metre / Second),
-1.76616533203125000e+04 * (Metre / Second),
-7.76112133789062500e+03 * (Metre / Second)}))));

auto const& mercury = plugin->GetCelestial(2);
EXPECT_THAT(mercury.body()->name(), Eq("Mercury"));

plugin->RequestReanimation(begin->time);

while (mercury.trajectory().t_min() > begin->time) {
absl::SleepFor(absl::Milliseconds(1));
}

// The history goes back far enough that we are still on our way to Mercury at
// the beginning.
EXPECT_THAT((begin->degrees_of_freedom.position() -
mercury.trajectory().EvaluatePosition(begin->time)).Norm(),
IsNear(176'400'999_⑴ * Kilo(Metre)));
EXPECT_THAT(begin->time,
Eq("1966-05-10T00:14:03"_TT + 0.0879862308502197 * Second));
EXPECT_THAT(begin->degrees_of_freedom,
Eq(DegreesOfFreedom<Barycentric>(
Barycentric::origin + Displacement<Barycentric>(
{-9.83735958466250000e+10 * Metre,
-1.05659916408781250e+11 * Metre,
-4.58171358797500000e+10 * Metre}),
Velocity<Barycentric>(
{+2.18567382812500000e+04 * (Metre / Second),
-1.76616533203125000e+04 * (Metre / Second),
-7.76112133789062500e+03 * (Metre / Second)}))));

// We arrive in late August. Check the state in the beginning of September.
// TODO(egg): Move the expected values for this initial state to a header in
// astronomy, and use that to look for the Лидов–古在 mechanism.
auto const it = orbiter.psychohistory().LowerBound("1966-09-01T00:00:00"_TT);
EXPECT_THAT(it->time,
Eq("1966-09-01T00:16:55"_TT + 0.2571494579315186 * Second));
EXPECT_THAT(it->degrees_of_freedom,
Eq(DegreesOfFreedom<Barycentric>(
Barycentric::origin + Displacement<Barycentric>(
{-2.40627773705000000e+10 * Metre,
+3.52445087251250000e+10 * Metre,
+2.13640458684375000e+10 * Metre}),
Velocity<Barycentric>(
{-5.19594188203811646e+04 * (Metre / Second),
-2.23741500134468079e+04 * (Metre / Second),
-7.15344990825653076e+03 * (Metre / Second)}))));
EXPECT_THAT((it->degrees_of_freedom.position() -
mercury.trajectory().EvaluatePosition(it->time))
.Norm(),
IsNear(19'163_⑴ * Kilo(Metre)));

// Make sure that we can upgrade, save, and reload.
WriteAndReadBack(std::move(plugin));
}


// Use for debugging saves given by users.
TEST_F(PluginCompatibilityTest, DISABLED_SECULAR_Debug) {
CheckSaveCompatibility(