Skip to content

Commit

Permalink
Add test to ensure loadouts are parsed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
VirxEC committed Dec 15, 2024
1 parent 1a0bb93 commit 4962007
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
8 changes: 8 additions & 0 deletions RLBotCSTests/RLBotCSTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
<Content Include="TomlTest/edge.toml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<Content Include="TomlTest/bot.toml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<Content Include="TomlTest/loadout.toml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
37 changes: 37 additions & 0 deletions RLBotCSTests/TomlParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,45 @@ public void TestParse()
Assert.AreEqual(Launcher.Custom, edgeMS.Launcher);
Assert.AreEqual("legendary", edgeMS.GamePath);
Assert.AreEqual(MatchLength.Five_Minutes, edgeMS.MutatorSettings.MatchLength);

Assert.AreEqual("Boomer", edgeMS.PlayerConfigurations[0].Name);
Assert.AreEqual(PlayerClass.Psyonix, edgeMS.PlayerConfigurations[0].Variety.Type);
Assert.AreEqual(292u, edgeMS.PlayerConfigurations[0].Loadout.DecalId);

Assert.AreEqual("Test Bot", edgeMS.PlayerConfigurations[1].Name);
Assert.AreEqual(PlayerClass.RLBot, edgeMS.PlayerConfigurations[1].Variety.Type);
Assert.AreEqual(69u, edgeMS.PlayerConfigurations[1].Loadout.TeamColorId);
Assert.AreEqual(0u, edgeMS.PlayerConfigurations[1].Loadout.CustomColorId);
Assert.AreEqual(23u, edgeMS.PlayerConfigurations[1].Loadout.CarId);
Assert.AreEqual(6083u, edgeMS.PlayerConfigurations[1].Loadout.DecalId);
Assert.AreEqual(1580u, edgeMS.PlayerConfigurations[1].Loadout.WheelsId);
Assert.AreEqual(35u, edgeMS.PlayerConfigurations[1].Loadout.BoostId);
Assert.AreEqual(0u, edgeMS.PlayerConfigurations[1].Loadout.AntennaId);
Assert.AreEqual(0u, edgeMS.PlayerConfigurations[1].Loadout.HatId);
Assert.AreEqual(1681u, edgeMS.PlayerConfigurations[1].Loadout.PaintFinishId);
Assert.AreEqual(1681u, edgeMS.PlayerConfigurations[1].Loadout.CustomFinishId);
Assert.AreEqual(5635u, edgeMS.PlayerConfigurations[1].Loadout.EngineAudioId);
Assert.AreEqual(3220u, edgeMS.PlayerConfigurations[1].Loadout.TrailsId);
Assert.AreEqual(4118u, edgeMS.PlayerConfigurations[1].Loadout.GoalExplosionId);
Assert.AreEqual(12u, edgeMS.PlayerConfigurations[1].Loadout.LoadoutPaint.CarPaintId);
Assert.AreEqual(12u, edgeMS.PlayerConfigurations[1].Loadout.LoadoutPaint.DecalPaintId);
Assert.AreEqual(
12u,
edgeMS.PlayerConfigurations[1].Loadout.LoadoutPaint.WheelsPaintId
);
Assert.AreEqual(12u, edgeMS.PlayerConfigurations[1].Loadout.LoadoutPaint.BoostPaintId);
Assert.AreEqual(
0u,
edgeMS.PlayerConfigurations[1].Loadout.LoadoutPaint.AntennaPaintId
);
Assert.AreEqual(0u, edgeMS.PlayerConfigurations[1].Loadout.LoadoutPaint.HatPaintId);
Assert.AreEqual(
12u,
edgeMS.PlayerConfigurations[1].Loadout.LoadoutPaint.TrailsPaintId
);
Assert.AreEqual(
12u,
edgeMS.PlayerConfigurations[1].Loadout.LoadoutPaint.GoalExplosionPaintId
);
}
}
3 changes: 3 additions & 0 deletions RLBotCSTests/TomlTest/bot.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
name = "Test Bot"
loadout_file = "loadout.toml"
4 changes: 4 additions & 0 deletions RLBotCSTests/TomlTest/edge.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ match_length = "random stuff"
name = "Boomer"
type = "psyonix"
skill = "allstar"

[[cars]]
config = "bot.toml"
team = 1
62 changes: 62 additions & 0 deletions RLBotCSTests/TomlTest/loadout.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[blue_loadout]
# Primary Color selection
team_color_id = 29
# Secondary Color selection
custom_color_id = 0
# Car type (Octane, Merc, etc)
car_id = 23
# Type of decal
decal_id = 6083
# Wheel selection
wheels_id = 1580
# Boost selection
boost_id = 35
# Antenna Selection
antenna_id = 0
# Hat Selection
hat_id = 0
# Paint Type (for first color)
paint_finish_id = 0
# Paint Type (for secondary color)
custom_finish_id = 0
# Engine Audio Selection
engine_audio_id = 6919
# Car trail Selection
trails_id = 3220
# Goal Explosion Selection
goal_explosion_id = 4118

[orange_loadout]
team_color_id = 69
custom_color_id = 0
car_id = 23
decal_id = 6083
wheels_id = 1580
boost_id = 35
antenna_id = 0
hat_id = 0
paint_finish_id = 1681
custom_finish_id = 1681
engine_audio_id = 5635
trails_id = 3220
goal_explosion_id = 4118

[blue_loadout.paint]
car_paint_id = 12
decal_paint_id = 12
wheels_paint_id = 12
boost_paint_id = 12
antenna_paint_id = 0
hat_paint_id = 0
trails_paint_id = 12
goal_explosion_paint_id = 12

[orange_loadout.paint]
car_paint_id = 12
decal_paint_id = 12
wheels_paint_id = 12
boost_paint_id = 12
antenna_paint_id = 0
hat_paint_id = 0
trails_paint_id = 12
goal_explosion_paint_id = 12

0 comments on commit 4962007

Please sign in to comment.