TSTRING cEncoder::Encode( TSTRING::const_iterator first, TSTRING::const_iterator last, sack_type::const_iterator encoding ) const { // encode it if( RoundTrip() ) return (*encoding)->EncodeRoundtrip( first, last ); else return (*encoding)->EncodePretty( first, last ); }
R"({ "type" : "points", "name" : "P1" }, )" R"({ "type" : "end_of_line", "name" : "B" }, )" R"({ "type" : "end_of_line", "name" : "C", "connect" : { "to" : "P1" } } )" "] }"; TEST_CASE( "track/ops/points/movement", "Test basic points movement future" ) { test_fixture_world_init_checked env(points_move_ops_test_str_1); points *p1; auto setup = [&]() { p1 = PTR_CHECK(env.w->FindTrackByNameCast<points>("P1")); }; auto test = [&](std::function<void()> RoundTrip) { env.w->SubmitAction(action_points_action(*(env.w), *p1, 0, generic_points::PTF::REV, generic_points::PTF::REV)); RoundTrip(); REQUIRE(p1->GetPointsFlags(0) == generic_points::PTF::ZERO); env.w->GameStep(500); RoundTrip(); REQUIRE(p1->GetPointsFlags(0) == (generic_points::PTF::REV | generic_points::PTF::OOC)); env.w->GameStep(4500); RoundTrip(); REQUIRE(p1->GetPointsFlags(0) == generic_points::PTF::REV); env.w->SubmitAction(action_points_action(*(env.w), *p1, 0, generic_points::PTF::LOCKED, generic_points::PTF::LOCKED)); env.w->GameStep(50); env.w->SubmitAction(action_points_action(*(env.w), *p1, 0, generic_points::PTF::REV, generic_points::PTF::REV)); env.w->GameStep(50); RoundTrip(); REQUIRE(p1->GetPointsFlags(0) == (generic_points::PTF::REV | generic_points::PTF::LOCKED)); env.w->SubmitAction(action_points_action(*(env.w), *p1, 0, generic_points::PTF::ZERO, generic_points::PTF::REV));