-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
166 lines (132 loc) · 3.89 KB
/
CMakeLists.txt
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
cmake_minimum_required(VERSION 2.6)
project(tddd16-lab3)
find_package(FLEX)
find_package(BISON)
set(CMAKE_CXX_FLAGS "-g -Wall -std=c++11 -stdlib=libc++")
enable_testing()
include_directories(${CMAKE_SOURCE_DIR}/include)
flex_target(scanner
lib/scanner.l
${CMAKE_BINARY_DIR}/scanner.l.cc
)
bison_target(parser
lib/parser.y
${CMAKE_BINARY_DIR}/parser.y.cc
)
add_flex_bison_dependency(scanner parser)
add_executable(parser
${FLEX_scanner_OUTPUTS}
${BISON_parser_OUTPUTS}
lib/ast.cc
lib/codegen.cc
lib/main.cc
lib/string.cc
lib/symtab.cc
lib/main.cc
)
add_test(
NAME empty_function
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/empty_function)
add_test(
NAME recursive_function
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/recursive_function)
add_test(
NAME nested_function
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/nested_function)
add_test(
NAME function_without_declaration
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/function_without_declaration)
add_test(
NAME addition
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/addition)
add_test(
NAME subtraction
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/subtraction)
add_test(
NAME multiplication
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/multiplication)
add_test(
NAME division
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/division)
add_test(
NAME exponentiation
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/exponentiation)
add_test(
NAME negation
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/negation)
add_test(
NAME integer
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/integer)
add_test(
NAME real
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/real)
add_test(
NAME identifier
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/identifier)
add_test(
NAME array_ref
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/array_ref)
add_test(
NAME coerced_expression
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/coerced_expression)
add_test(
NAME complex_expression
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/expressions/complex_expression)
add_test(
NAME greater_or_equal
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/conditions/greater_or_equal)
add_test(
NAME less_or_equal
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/conditions/less_or_equal)
add_test(
NAME greater
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/conditions/greater)
add_test(
NAME less
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/conditions/less)
add_test(
NAME equal
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/conditions/equal)
add_test(
NAME not_equal
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/conditions/not_equal)
add_test(
NAME and
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/conditions/and)
add_test(
NAME or
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/conditions/or)
add_test(
NAME not
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/conditions/not)
add_test(
NAME complex_condition
COMMAND ${CMAKE_BINARY_DIR}/parser ${CMAKE_SOURCE_DIR}/test/conditions/complex_condition)
set_tests_properties(
empty_function
recursive_function
nested_function
function_without_declaration
addition
subtraction
multiplication
division
exponentiation
negation
integer
real
identifier
array_ref
coerced_expression
complex_expression
greater_or_equal
less_or_equal
greater
less
equal
not_equal
and
or
not
complex_condition
PROPERTIES FAIL_REGULAR_EXPRESSION "Error")