From c94d0c347fdbd8acc774df4ac17617a3f63e4507 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 9 Jul 2017 23:48:06 +0200 Subject: 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. --- Testing/include/simulation/SimulationHistoryTest.h | 48 ---------- .../simulation/workloads/SimpleSchedulerTest.h | 106 --------------------- .../simulation/workloads/WorkloadHistoryTest.h | 15 --- .../include/simulation/workloads/WorkloadTest.h | 34 ------- 4 files changed, 203 deletions(-) delete mode 100644 Testing/include/simulation/SimulationHistoryTest.h delete mode 100644 Testing/include/simulation/workloads/SimpleSchedulerTest.h delete mode 100644 Testing/include/simulation/workloads/WorkloadHistoryTest.h delete mode 100644 Testing/include/simulation/workloads/WorkloadTest.h (limited to 'Testing/include/simulation') 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 - -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 -#include - -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> machines; - machines.push_back(std::reference_wrapper(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> machines; - machines.push_back(std::reference_wrapper(machine1)); - machines.push_back(std::reference_wrapper(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> machines; - machines.push_back(std::reference_wrapper(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 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 - -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 - -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()); -} -- cgit v1.2.3