diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2017-07-09 23:48:06 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2017-07-09 23:48:06 +0200 |
| commit | c94d0c347fdbd8acc774df4ac17617a3f63e4507 (patch) | |
| tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /Testing/include/simulation | |
| parent | bc4c41e21a64b444bdbab3b6d1d407fd5d919419 (diff) | |
Delete old codebase
This change removes version 1 of the OpenDC simulator codebase as it
will be replaced by a complete rewrite in the Kotlin language.
Diffstat (limited to 'Testing/include/simulation')
4 files changed, 0 insertions, 203 deletions
diff --git a/Testing/include/simulation/SimulationHistoryTest.h b/Testing/include/simulation/SimulationHistoryTest.h deleted file mode 100644 index d519de89..00000000 --- a/Testing/include/simulation/SimulationHistoryTest.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once -#include "simulation\SimulationHistory.h" -#include "simulation\workloads\WorkloadHistory.h" - -#include <gtest\gtest.h> - -TEST(SimulationHistoryTest, SetGetHistoryAtTick) -{ - Simulation::SimulationHistory simulationHistory; - Simulation::WorkloadHistory workloadHistory; - workloadHistory.setFlopsDone(1, 100); - - simulationHistory.setHistoryAtTick(1, workloadHistory); - - auto resultHistory = simulationHistory.getHistoryAtTick(1); - ASSERT_EQ(resultHistory.history.at(0).first, 1); - ASSERT_EQ(resultHistory.history.at(0).second, 100); -} - -TEST(SimulationHistoryTest, ClearHistory) -{ - Simulation::SimulationHistory simulationHistory; - Simulation::WorkloadHistory workloadHistory; - simulationHistory.setHistoryAtTick(1, workloadHistory); - - ASSERT_EQ(simulationHistory.workloadHistories.size(), 1); - - simulationHistory.clearHistory(); - - ASSERT_EQ(simulationHistory.workloadHistories.size(), 0); -} - -TEST(SimulationHistoryTest, GetHistorySize) -{ - Simulation::SimulationHistory simulationHistory; - Simulation::WorkloadHistory workloadHistory; - simulationHistory.setHistoryAtTick(1, workloadHistory); - - ASSERT_EQ(simulationHistory.getHistorySize(), 1); - - simulationHistory.setHistoryAtTick(2, workloadHistory); - - ASSERT_EQ(simulationHistory.getHistorySize(), 2); - - simulationHistory.clearHistory(); - - ASSERT_EQ(simulationHistory.getHistorySize(), 0); -}
\ No newline at end of file diff --git a/Testing/include/simulation/workloads/SimpleSchedulerTest.h b/Testing/include/simulation/workloads/SimpleSchedulerTest.h deleted file mode 100644 index 07b4416f..00000000 --- a/Testing/include/simulation/workloads/SimpleSchedulerTest.h +++ /dev/null @@ -1,106 +0,0 @@ -#pragma once -#include "simulation\workloads\SimpleScheduler.h" -#include "simulation\workloads\Workload.h" -#include "modeling\Machine.h" - -#include <vector> -#include <gtest\gtest.h> - -TEST(SimpleSchedulerTest, ScheduleSingleMachine) -{ - // Initialization - Simulation::SimpleScheduler scheduler; - Simulation::Workload workload1(100, 0, 1, 1, 0); - Simulation::Workload workload2(150, 0, 1, 1, 0); - Modeling::Machine machine(10); - - std::vector<std::reference_wrapper<Modeling::Machine>> machines; - machines.push_back(std::reference_wrapper<Modeling::Machine>(machine)); - scheduler.addWorkload(workload1); - scheduler.addWorkload(workload2); - - // Distribute tasks across machines - scheduler.schedule(machines); - - // Do work - for (auto machine : machines) - machine.get().tick(); - - // Assert work done - auto workloads = scheduler.getWorkloads(); - auto workload1Remaining = workloads.at(0).lock()->getRemainingOperations(); - auto workload2Remaining = workloads.at(1).lock()->getRemainingOperations(); - ASSERT_EQ(workload1Remaining, 90); - ASSERT_EQ(workload2Remaining, 150); -} - -TEST(SimpleSchedulerTest, ScheduleMultipleMachine) -{ - // Initialization - Simulation::SimpleScheduler scheduler; - Simulation::Workload workload1(100, 0, 1, 1, 0); - Simulation::Workload workload2(150, 0, 1, 1, 0); - Modeling::Machine machine1(10); - Modeling::Machine machine2(30); - - std::vector<std::reference_wrapper<Modeling::Machine>> machines; - machines.push_back(std::reference_wrapper<Modeling::Machine>(machine1)); - machines.push_back(std::reference_wrapper<Modeling::Machine>(machine2)); - scheduler.addWorkload(workload1); - scheduler.addWorkload(workload2); - - // Distribute tasks across machines - scheduler.schedule(machines); - - // Do work - for (auto machine : machines) - machine.get().tick(); - - // Assert work done - auto workloads = scheduler.getWorkloads(); - auto workload1Remaining = workloads.at(0).lock()->getRemainingOperations(); - auto workload2Remaining = workloads.at(1).lock()->getRemainingOperations(); - ASSERT_EQ(workload1Remaining, 60); - ASSERT_EQ(workload2Remaining, 150); -} - -TEST(SimpleSchedulerTest, ScheduleFinishTask) -{ - // Initialization - Simulation::SimpleScheduler scheduler; - Simulation::Workload workload1(100, 0, 1, 1, 0); - Modeling::Machine machine1(100); - - std::vector<std::reference_wrapper<Modeling::Machine>> machines; - machines.push_back(std::reference_wrapper<Modeling::Machine>(machine1)); - scheduler.addWorkload(workload1); - ASSERT_TRUE(scheduler.hasWorkloads()); - - // Distribute tasks across machines - scheduler.schedule(machines); - - // Do work - for (auto machine : machines) - machine.get().tick(); - - // Distribute tasks across machines again, this is when finished workloads get cleared - scheduler.schedule(machines); - - // Assert work done - auto workloads = scheduler.getWorkloads(); - ASSERT_EQ(workloads.size(), 0); - ASSERT_FALSE(scheduler.hasWorkloads()); -} - -TEST(SimpleSchedulerTest, AddMultipleWorkloads) -{ - Simulation::SimpleScheduler ss; - std::vector<Simulation::Workload> workloads{ - Simulation::Workload(100, 0, 1, 1, 0), - Simulation::Workload(100, 0, 1, 1, 0) - }; - ss.addWorkloads(workloads); - - ASSERT_TRUE(ss.hasWorkloads()); - ASSERT_EQ(ss.getWorkloads().size(), 2); -}
\ No newline at end of file diff --git a/Testing/include/simulation/workloads/WorkloadHistoryTest.h b/Testing/include/simulation/workloads/WorkloadHistoryTest.h deleted file mode 100644 index 4cf7f4e3..00000000 --- a/Testing/include/simulation/workloads/WorkloadHistoryTest.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once -#include "simulation\workloads\WorkloadHistory.h" - -#include <gtest\gtest.h> - -TEST(WorkloadHistoryTest, SetFlopsDone) -{ - Simulation::WorkloadHistory history; - history.setFlopsDone(1, 5); - - auto a = history.history.at(0); - - ASSERT_EQ(a.first, 1); - ASSERT_EQ(a.second, 5); -}
\ No newline at end of file diff --git a/Testing/include/simulation/workloads/WorkloadTest.h b/Testing/include/simulation/workloads/WorkloadTest.h deleted file mode 100644 index e0da2138..00000000 --- a/Testing/include/simulation/workloads/WorkloadTest.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once -#include "simulation\workloads\Workload.h" - -#include <gtest\gtest.h> - -TEST(WorkloadTest, Constructor) -{ - Simulation::Workload w(100, 0, 5, 3, 0); - ASSERT_EQ(false, w.isFinished()); - ASSERT_EQ(5, w.getId()); - ASSERT_EQ(100, w.getRemainingOperations()); - ASSERT_EQ(100, w.getTotalOperations()); -} - -TEST(WorkloadTest, DoOperations) -{ - Simulation::Workload w(100, 0, 5, 3, 0); - w.doOperations(10); - ASSERT_EQ(90, w.getRemainingOperations()); -} - -TEST(WorkloadTest, GetTotalOperations) -{ - Simulation::Workload w(100, 0, 5, 3, 0); - w.doOperations(10); - ASSERT_EQ(100, w.getTotalOperations()); -} - -TEST(WorkloadTest, IsFinished) -{ - Simulation::Workload w(10, 0, 5, 3, 0); - w.doOperations(10); - ASSERT_EQ(true, w.isFinished()); -} |
