From 070ce923574dcc57435cb3fb2dfe86b6a38cd249 Mon Sep 17 00:00:00 2001 From: MDBijman Date: Tue, 24 Jan 2017 12:15:26 +0100 Subject: Initial code commit with organized dependencies --- Testing/include/modeling/MachineTest.h | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Testing/include/modeling/MachineTest.h (limited to 'Testing/include/modeling/MachineTest.h') 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 + +TEST(MachineTest, GetSpeed) +{ + Modeling::Machine m(100); + + ASSERT_EQ(m.getSpeed(), 100); +} + +TEST(MachineTest, IsBusy) +{ + Modeling::Machine m(100); + std::shared_ptr shrdWorkload = std::make_shared(150, 1, 1, 1); + ASSERT_FALSE(m.isBusy()); + + m.giveTask(std::weak_ptr(shrdWorkload)); + + ASSERT_TRUE(m.isBusy()); +} + +TEST(MachineTest, Tick) +{ + Modeling::Machine m(100); + std::shared_ptr shrdWorkload = std::make_shared(150, 1, 1, 1); + m.giveTask(std::weak_ptr(shrdWorkload)); + + ASSERT_TRUE(m.isBusy()); + + m.tick(); + + ASSERT_TRUE(m.isBusy()); + + m.tick(); + + ASSERT_FALSE(m.isBusy()); +} \ No newline at end of file -- cgit v1.2.3