Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* BDSP AutoStory Story Simulation Tests

Check warning on line 1 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=638 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -486,6 +486,42 @@
return true;
}

// Walks are planned on the maps: a LEGS step ("east 6, north 18") is
// left only where no route can do its job, each with its reason.
UnitTestResult test_no_hand_written_legs(Logger&){

Check warning on line 491 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonBDSP::test_no_hand_written_legs( Logger &): function_lines=33 (advisory above 25, limit 50)
const std::map<std::string, std::string> exceptions = {
{"00.01/off_barrys_mat", "steps off a door's mat, where no route starts"},
{"00.03/into_sandgem", "walks until Dawn's scene starts, wherever it starts"},
{"00.04/to_route_201", "runs until Route 201's banner, wherever it shows"},
{"00.04/to_moms_call", "walks until Mom calls, wherever she calls"},
{"00.05/up_to_barry", "starts inside the School's door, from no known tile"},
{"01.03/down_the_hall", "steps off the hall's warp tile, where no route starts"},
{"01.03/down_to_the_boulder", "steps off the coal room's warp tile, where no route starts"},
{"01.03/up_the_hall", "steps off the hall's warp tile, where no route starts"},
{"01.03/up_to_the_mines_sign", "steps off the mine's exit, where no route starts"},
{"01.11/up_to_the_old_woman", "walks until the old woman stops us"},
};
std::set<std::string> seen;
for (const StoryCheckpoint& row : story_checkpoints()){
for (const StoryStep& step : row.steps){
if (step.kind != StoryStepKind::LEGS){
continue;
}
const std::string key = std::format("{}/{}", row.id, step.name);
if (!exceptions.contains(key)){
return std::format("{}: hand-written legs; plan a route to where they end.", key);
}
seen.insert(key);
}
}
for (const auto& item : exceptions){
if (!seen.contains(item.first)){
return std::format("{}: listed as an exception, but no such LEGS step.", item.first);
}
}
return true;
}

// Legs that run off the end of their map land on the next one of the same
// world: east along Route 201's top row ends in Sandgem, not off the map.
UnitTestResult test_legs_cross_maps(Logger&){
Expand Down Expand Up @@ -583,6 +619,10 @@
.input = {"no text reader for the game's language", test_no_text_reader},
.expectation = {},
},
{
.input = {"no hand-written legs but the listed ones", test_no_hand_written_legs},
.expectation = {},
},
};

void add_tests_AutoStory_StorySimulation(UnitTestDatabase& database){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@
{
"args": {
"fight_wild": false,
"legs": [
{
"direction": "north",
"tiles": 1
},
{
"direction": "east",
"tiles": 1
}
]
"target": {
"facing": "east",
"map": "PlayerHouse2F",
"tiles": [
[
8,
4
]
]
}
},
"id": "onto_the_flute_tile",
"kind": "legs",
"why": "up onto (7, 4), then east onto the top of the stairs' mat (8, 4)"
"kind": "route",
"why": "onto the top of the stairs' mat (8, 4), past the flute's tile"
},
{
"args": {
Expand Down Expand Up @@ -212,16 +212,20 @@
{
"args": {
"fight_wild": false,
"legs": [
{
"direction": "north",
"tiles": 1
}
]
"target": {
"facing": "north",
"map": "TwinleafTown",
"tiles": [
[
9,
12
]
]
}
},
"id": "back_onto_barrys_doorstep",
"kind": "legs",
"why": "back to (9, 12); its trigger is spent"
"kind": "route",
"why": "back to his doorstep (9, 12); its trigger is spent"
},
{
"args": {
Expand Down Expand Up @@ -380,20 +384,20 @@
{
"args": {
"fight_wild": false,
"legs": [
{
"direction": "east",
"tiles": 6
},
{
"direction": "north",
"tiles": 18
}
]
"target": {
"facing": "north",
"map": "Route201",
"tiles": [
[
15,
19
]
]
}
},
"id": "below_barrys_warning",
"kind": "legs",
"why": "along row 12, then up Twinleaf's exit to Route 201 (15, 19)"
"kind": "route",
"why": "below the trigger, up Twinleaf's exit to Route 201 (15, 19)"
},
{
"args": {
Expand All @@ -420,24 +424,20 @@
{
"args": {
"fight_wild": false,
"legs": [
{
"direction": "west",
"tiles": 1
},
{
"direction": "north",
"tiles": 1
},
{
"direction": "west",
"tiles": 2
}
]
"target": {
"facing": "west",
"map": "Route201",
"tiles": [
[
12,
17
]
]
}
},
"id": "away_from_barry",
"kind": "legs",
"why": "to (12, 17): row 18 west of the path is trees (r16), the dirt goes on along row 17"
"kind": "route",
"why": "to (12, 17): row 18 west of the path is trees, the dirt goes on along row 17"
},
{
"args": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
{
"args": {
"fight_wild": false,
"legs": [
{
"direction": "north",
"tiles": 1
}
]
"target": {
"facing": "north",
"map": "VerityLakefront",
"tiles": [
[
17,
13
]
]
}
},
"id": "to_the_lake_entrance",
"kind": "legs",
"kind": "route",
"why": "a tile short of the trigger"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,19 @@
{
"args": {
"fight_wild": false,
"legs": [
{
"direction": "west",
"tiles": 1
},
{
"direction": "south",
"tiles": 2
}
]
"target": {
"facing": "south",
"map": "PlayerHouse1F",
"tiles": [
[
5,
9
]
]
}
},
"id": "around_mom",
"kind": "legs",
"kind": "route",
"why": "around Mom at (6, 8), to beside the door's column"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,33 +122,19 @@
"args": {
"fight_wild": false,
"target": {
"facing": "north",
"map": "SandgemTown",
"tiles": [
[
20,
17,
11
]
]
}
},
"id": "to_center_sign",
"kind": "route",
"why": "below the Center's sign, its doorway in sight"
},
{
"action": "one_short_ok",
"args": {
"fight_wild": false,
"legs": [
{
"direction": "west",
"tiles": 3
}
]
},
"id": "below_center_door",
"kind": "legs",
"why": "taps west below the Center's door"
"kind": "route",
"why": "below the Center's door"
},
{
"declared_after": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
{
"checkpoint": {
"events": [
{
"args": {
"fight_wild": false,
"legs": [
{
"direction": "west",
"tiles": 1
},
{
"direction": "north",
"tiles": 2
}
]
},
"id": "up_the_steps",
"kind": "legs",
"why": "a tile west of the save, then up the steps to (47, 60)"
},
{
"action": "town",
"args": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@
{
"args": {
"fight_wild": false,
"legs": [
{
"direction": "east",
"tiles": 2
}
]
"target": {
"facing": "east",
"map": "JubilifeCity",
"tiles": [
[
48,
40
]
]
}
},
"id": "past_the_president",
"kind": "legs",
"kind": "route",
"why": "east of his column"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
"checkpoint": {
"events": [
{
"action": "to_wall",
"args": {
"fight_wild": false,
"legs": [
{
"direction": "south",
"tiles": 4
}
]
"target": {
"facing": "south",
"map": "Route203",
"tiles": [
[
5,
20
]
]
}
},
"declared_after": {
"facing": "south",
Expand All @@ -23,7 +26,7 @@
]
},
"id": "south_to_the_cliff",
"kind": "legs",
"kind": "route",
"why": "down the trigger's column to the cliff"
},
{
Expand Down
Loading
Loading