Skip to content

Commit

Permalink
Tests: added better logic for multiple iterations of sim during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fyziktom committed Dec 11, 2024
1 parent f98851f commit da8dd53
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ public void BasicTest()
BaseSimulator.GetSimulatedData(message);
Assert.NotNull(message.MotionStates);

var message1 = new ChesterMotionCloudMessage();
BaseSimulator.GetSimulatedData(message1, message);
ChesterMotionCloudMessage[] msgs = new ChesterMotionCloudMessage[10];
msgs[0] = message;

var message2 = new ChesterMotionCloudMessage();
BaseSimulator.GetSimulatedData(message2, message1);
for (int i = 1; i < 10; i++)
{
msgs[i] = new ChesterMotionCloudMessage();
BaseSimulator.GetSimulatedData(msgs[i], msgs[i - 1]);
}

var message3 = new ChesterMotionCloudMessage();
BaseSimulator.GetSimulatedData(message3, message2);

var state = message.MotionStates?.CountLeft;
var state3 = message3.MotionStates?.CountLeft;
Assert.True(state3 > state);
var state = msgs[0].MotionStates?.CountLeft;
var state1 = msgs[9].MotionStates?.CountLeft;
Assert.True(state1 > state);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,18 @@ public void BasicTest()
BaseSimulator.GetSimulatedData(message);
Assert.NotEqual(message.Weights.Count, 0);

var message1 = new ChesterScaleCloudMessage();
BaseSimulator.GetSimulatedData(message1, message);
ChesterScaleCloudMessage[] msgs = new ChesterScaleCloudMessage[10];
msgs[0] = message;

var message2 = new ChesterScaleCloudMessage();
BaseSimulator.GetSimulatedData(message2, message1);
for (int i = 1; i < 10; i++)
{
msgs[i] = new ChesterScaleCloudMessage();
BaseSimulator.GetSimulatedData(msgs[i], msgs[i-1]);
}

var message3 = new ChesterScaleCloudMessage();
BaseSimulator.GetSimulatedData(message3, message2);

var message4 = new ChesterScaleCloudMessage();
BaseSimulator.GetSimulatedData(message4, message3);

var weight = message.Weights[0];
var weight4 = message4.Weights[0];
Assert.True(weight4.A2 > weight.A2);
var weight = msgs[0].Weights[0];
var weight1 = msgs[9].Weights[0];
Assert.True(weight1.A2 > weight.A2);
}
}
}

0 comments on commit da8dd53

Please sign in to comment.