|
|
|
@ -68,6 +68,44 @@ TEST_F(SimulatorTiming, LongTimeElapses) {
|
|
|
|
|
assertTimeElapses(t_500_000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(SimulatorTiming, 3msPerCycleTestRunCycles) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sim_.SetCycleTime(3);
|
|
|
|
|
// Record time at start
|
|
|
|
|
uint32_t start = Kaleidoscope.millisAtCycleStart();
|
|
|
|
|
// Run cycles until the given amount of time has elapsed
|
|
|
|
|
sim_.RunCycles(1);
|
|
|
|
|
// Record time at end
|
|
|
|
|
uint32_t end = Kaleidoscope.millisAtCycleStart();
|
|
|
|
|
ASSERT_EQ((end - start), 3) << "Start was " << start << " and end was " << end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Record time at start
|
|
|
|
|
start = Kaleidoscope.millisAtCycleStart();
|
|
|
|
|
// Run cycles until the given amount of time has elapsed
|
|
|
|
|
sim_.RunCycles(10);
|
|
|
|
|
// Record time at end
|
|
|
|
|
end = Kaleidoscope.millisAtCycleStart();
|
|
|
|
|
ASSERT_EQ((end - start), 30) << "Start was " << start << " and end was " << end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(SimulatorTiming, 4msPerCycleTestRunForMillis) {
|
|
|
|
|
sim_.SetCycleTime(4);
|
|
|
|
|
// Record time at start
|
|
|
|
|
uint32_t start = Kaleidoscope.millisAtCycleStart();
|
|
|
|
|
// Run cycles until the given amount of time has elapsed
|
|
|
|
|
sim_.RunForMillis(40);
|
|
|
|
|
// Record time at end
|
|
|
|
|
uint32_t end = Kaleidoscope.millisAtCycleStart();
|
|
|
|
|
ASSERT_EQ((end - start), 40);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
} // namespace testing
|
|
|
|
|
} // namespace kaleidoscope
|
|
|
|
|