summaryrefslogtreecommitdiffstats
path: root/tests/BlockTypeRegistry/CMakeLists.txt
blob: b9036ffdfc8b73f8bbbbd5e669ff72110d98ba89 (plain) (blame)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
find_package(Threads REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/src/)

# Define individual test executables:

# BlockStateTest: Verify that the BlockState class works as intended:
add_executable(BlockStateTest
	BlockStateTest.cpp
	../TestHelpers.h
	${PROJECT_SOURCE_DIR}/src/BlockState.cpp
	${PROJECT_SOURCE_DIR}/src/StringUtils.cpp
	${PROJECT_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
)
target_link_libraries(BlockStateTest fmt::fmt)

add_executable(BlockTypePaletteTest
	BlockTypePaletteTest.cpp
	../TestHelpers.h
	${PROJECT_SOURCE_DIR}/src/BlockState.cpp
	${PROJECT_SOURCE_DIR}/src/BlockTypePalette.cpp
	${PROJECT_SOURCE_DIR}/src/JsonUtils.cpp
	${PROJECT_SOURCE_DIR}/src/StringUtils.cpp
	${PROJECT_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
	${PROJECT_SOURCE_DIR}/src/OSSupport/File.cpp
)
target_link_libraries(BlockTypePaletteTest fmt::fmt jsoncpp_lib)

# BlockTypeRegistryTest: Verify that the BlockTypeRegistry class works as intended:
add_executable(BlockTypeRegistryTest
	BlockTypeRegistryTest.cpp
	../TestHelpers.h
	${PROJECT_SOURCE_DIR}/src/BlockTypeRegistry.cpp
	${PROJECT_SOURCE_DIR}/src/StringUtils.cpp
	${PROJECT_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
)
target_link_libraries(BlockTypeRegistryTest fmt::fmt Threads::Threads)

# PalettedBlockAreaTest: Verify that the PalettedBlockArea class works as intended:
add_executable(PalettedBlockAreaTest
	PalettedBlockAreaTest.cpp
	../TestHelpers.h
	${PROJECT_SOURCE_DIR}/src/BlockState.cpp
	${PROJECT_SOURCE_DIR}/src/BlockTypeRegistry.cpp
	${PROJECT_SOURCE_DIR}/src/BlockTypePalette.cpp
	${PROJECT_SOURCE_DIR}/src/Cuboid.cpp
	${PROJECT_SOURCE_DIR}/src/JsonUtils.cpp
	${PROJECT_SOURCE_DIR}/src/PalettedBlockArea.cpp
	${PROJECT_SOURCE_DIR}/src/StringUtils.cpp
	${PROJECT_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
)
target_link_libraries(PalettedBlockAreaTest fmt::fmt jsoncpp_lib)

# Extra files for BlockTypePalette test:
file (COPY
	../../Server/Protocol/1.13/base.btp.txt
	../../Server/Protocol/UpgradeBlockTypePalette.txt
	DESTINATION ./
)







# Define individual tests:

add_test(NAME BlockStateTest        COMMAND BlockStateTest)
add_test(NAME BlockTypeRegistryTest COMMAND BlockTypeRegistryTest)
add_test(NAME BlockTypePaletteTest  COMMAND BlockTypePaletteTest)
add_test(NAME PalettedBlockAreaTest COMMAND PalettedBlockAreaTest)





# Put all the tests into a solution folder (MSVC):
set_target_properties(
	BlockStateTest
	BlockTypeRegistryTest
	BlockTypePaletteTest
	PalettedBlockAreaTest
	PROPERTIES FOLDER Tests/BlockTypeRegistry
)