Skip to content

Commit

Permalink
Add GameState serialize from default regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
VirxEC committed Jun 28, 2024
1 parent 04cd292 commit c3f20cc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
22 changes: 11 additions & 11 deletions RLBotCSTests/BallPrediction.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Bridge.Models.Phys;
using Bridge.Packet;
using Bridge.State;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RLBotCS.ManagerTools;

Expand All @@ -13,17 +13,17 @@ public void TestBallPred()
{
BallPredictor.SetMode(PredictionMode.Standard);

var currentBall = new Ball()
{
Physics = new Physics(
new Vector3(0, 0, 100),
new Vector3(600, 600, 100),
new Vector3(1, 2, 0.5F),
new Rotator(0, 0, 0)
)
};
var packet = new GameState();
BallPredictor.Generate(PredictionMode.Standard, 1, packet.Ball);

var ballPred = BallPredictor.Generate(PredictionMode.Standard, 1, currentBall);
packet.Ball.Physics = new Physics(
new Vector3(0, 0, 100),
new Vector3(600, 600, 100),
new Vector3(1, 2, 0.5F),
new Rotator(0, 0, 0)
);

var ballPred = BallPredictor.Generate(PredictionMode.Standard, 1, packet.Ball);

int numSlices = 8 * 120;
Assert.AreEqual(numSlices, ballPred.Slices.Count);
Expand Down
20 changes: 20 additions & 0 deletions RLBotCSTests/GameState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Bridge.State;
using Google.FlatBuffers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RLBotCS.Conversion;

namespace RLBotCSTests
{
[TestClass]
public class TestGameState
{
[TestMethod]
public void Test()
{
var packet = new GameState();

FlatBufferBuilder build = new(1024);
packet.ToFlatBuffers(build);
}
}
}

0 comments on commit c3f20cc

Please sign in to comment.