summaryrefslogtreecommitdiff
path: root/Testing/include/modeling/MachineTest.h
blob: 6bba9d0dd4112f0f305455811fe8c2fecfea99f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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());
}