summaryrefslogtreecommitdiff
path: root/universe/tests/TurretType.cpp
blob: 7ce70c014e640c0d0dd59a240e447ea9bb4b6c82 (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
40
41
42
43
44
45
46
47
48
49
#include <gtest/gtest.h>

#include <kurator/universe/TurretType.h>


namespace kurator
{
namespace tests
{


const universe::TurretType LOW {
	"",
	1,
	10.0,
	1.0,
	0.0,
	1000.0,
	0.05,
	0.2,
};


const universe::TurretType HIGH {
	"",
	1,
	1000.0,
	1.0,
	0.0,
	1000.0,
	0.05,
	0.2,
};



TEST(TurretType, effective_range)
{
	const auto low = LOW.effective_range();
	EXPECT_LE(1.0, LOW.range_modifier(low - 1.0) * LOW.base_damage);
	EXPECT_GE(1.0, LOW.range_modifier(low + 1.0) * LOW.base_damage);
	const auto high = HIGH.effective_range();
	EXPECT_LE(1.0, HIGH.range_modifier(high - 1.0) * HIGH.base_damage);
	EXPECT_GE(1.0, HIGH.range_modifier(high + 1.0) * HIGH.base_damage);
}


}  // namespace tests
}  // namespace kurator