summaryrefslogtreecommitdiff
path: root/Testing/include/modeling/MachineTest.h
diff options
context:
space:
mode:
authorMDBijman <matthijs@bijman.org>2017-01-24 12:15:26 +0100
committerMDBijman <matthijs@bijman.org>2017-01-24 12:15:26 +0100
commit070ce923574dcc57435cb3fb2dfe86b6a38cd249 (patch)
treeffd69a842ac4ad22aaf7161f923b9f0b47c7147a /Testing/include/modeling/MachineTest.h
Initial code commit with organized dependencies
Diffstat (limited to 'Testing/include/modeling/MachineTest.h')
-rw-r--r--Testing/include/modeling/MachineTest.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/Testing/include/modeling/MachineTest.h b/Testing/include/modeling/MachineTest.h
new file mode 100644
index 00000000..6bba9d0d
--- /dev/null
+++ b/Testing/include/modeling/MachineTest.h
@@ -0,0 +1,39 @@
+#pragma once
+#include "modeling\Machine.h"
+
+#include <gtest\gtest.h>
+
+TEST(MachineTest, GetSpeed)
+{
+ Modeling::Machine m(100);
+
+ ASSERT_EQ(m.getSpeed(), 100);
+}
+
+TEST(MachineTest, IsBusy)
+{
+ Modeling::Machine m(100);
+ std::shared_ptr<Simulation::Workload> shrdWorkload = std::make_shared<Simulation::Workload>(150, 1, 1, 1);
+ ASSERT_FALSE(m.isBusy());
+
+ m.giveTask(std::weak_ptr<Simulation::Workload>(shrdWorkload));
+
+ ASSERT_TRUE(m.isBusy());
+}
+
+TEST(MachineTest, Tick)
+{
+ Modeling::Machine m(100);
+ std::shared_ptr<Simulation::Workload> shrdWorkload = std::make_shared<Simulation::Workload>(150, 1, 1, 1);
+ m.giveTask(std::weak_ptr<Simulation::Workload>(shrdWorkload));
+
+ ASSERT_TRUE(m.isBusy());
+
+ m.tick();
+
+ ASSERT_TRUE(m.isBusy());
+
+ m.tick();
+
+ ASSERT_FALSE(m.isBusy());
+} \ No newline at end of file