Skip to content

Commit

Permalink
chore: implemented changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
charliekush committed Aug 28, 2024
1 parent 72eeeb0 commit d0a2c27
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(GTEST_SOURCE_FILES
tests/scheduler_test_system.cpp
tests/test_ensembles.cpp
tests/fixed_google_tests.cpp
tests/file_google_tests.cpp
src/scheduler.cpp
tests/scheduler_test_flog.cpp
tests/test_file_system.cpp
Expand Down
19 changes: 1 addition & 18 deletions tests/file_google_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,12 @@ class SchedulerTestsFromFiles : public ::testing::TestWithParam<std::string>
e = { nullptr, nullptr, 0, 0, 0, 0, "", {0}};
deploymentSchedule.emplace_back(e);
scheduler = std::make_unique<Scheduler>(deploymentSchedule.data());



scheduler->initializeScheduler();

while (millis() < input.end)
{
scheduler->getNextTask(&nextEvent, &nextEventTime,
millis());

std::uint32_t afterDelay = input.getDelay(nextEvent->taskName,
nextEvent->state.measurementCount - 1);

Expand All @@ -204,14 +200,7 @@ class SchedulerTestsFromFiles : public ::testing::TestWithParam<std::string>
return;
}
}


}






/**
* @brief Run task, update time, and check values
Expand Down Expand Up @@ -266,13 +255,7 @@ class SchedulerTestsFromFiles : public ::testing::TestWithParam<std::string>
ASSERT_EQ(expectedStart, actualStart) << failMessage.str();
ASSERT_EQ(expectedEnd, actualEnd) << failMessage.str();
}
/**
* @brief Runs the next event and updates clock
*
* @param ScheduleTable_t contains ensemble table
* @param p_nextEvent pointer to next event
* @param p_nextTime pointer to next time to run
*/




Expand Down
11 changes: 7 additions & 4 deletions tests/fixed_google_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ class SchedulerFixedTests : public ::testing::Test
* before calling "run()"
*/

void three_task_change_intervals(std::uint32_t A_interval, std::uint32_t B_interval, std::uint32_t C_interval) {
void three_task_change_intervals(std::uint32_t A_interval,
std::uint32_t B_interval, std::uint32_t C_interval) {
deployment_table[0].ensembleInterval = A_interval;
deployment_table[1].ensembleInterval = B_interval;
deployment_table[2].ensembleInterval = C_interval;
Expand All @@ -110,7 +111,8 @@ class SchedulerFixedTests : public ::testing::Test
* before calling "run()"
*/

void two_task_change_intervals(std::uint32_t A_interval, std::uint32_t B_interval) {
void two_task_change_intervals(std::uint32_t A_interval,
std::uint32_t B_interval) {
deployment_table[0].ensembleInterval = A_interval;
deployment_table[1].ensembleInterval = B_interval;
}
Expand Down Expand Up @@ -143,7 +145,8 @@ class SchedulerFixedTests : public ::testing::Test
* priority task in deployment table.
*/

void add_task(const char * task_name, std::uint32_t duration, std::uint32_t interval){
void add_task(const char * task_name, std::uint32_t duration,
std::uint32_t interval){

DeploymentSchedule_ task= {SS_ensembleCFunc, SS_ensembleCInit, 1,
interval, duration, UINT32_MAX, task_name, {0}};
Expand Down Expand Up @@ -213,7 +216,7 @@ class SchedulerFixedTests : public ::testing::Test
for(int i=0; i<num_tasks; i++){
table[i]=deployment_table[i];
}
table[num_tasks]= {nullptr, nullptr, 0, 0, 0, 0, nullptr, {0}};
table[num_tasks]= {nullptr, nullptr, 0, 0, 0, 0, nullptr, {0}};
Scheduler scheduler(table);
scheduler.initializeScheduler();
std::uint32_t nextTime = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/inputs/delay.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENSEMBLES #taskname|interval|duration or taskname|interval|duration|maxDelay
A|2000|400
B|2000|200
C|2000|600
DELAYS #0 indexed: "taskname|iteration|delay" or "taskname|iteration|delay|before" (after implied)
DELAYS #0 indexed: "taskname|iteration|delay"
B|1|900
EXPECTED #"taskname|start|end"
A|0|400
Expand Down

0 comments on commit d0a2c27

Please sign in to comment.