Skip to content

Commit 68e4d6b

Browse files
author
Thomas Kiley
authored
Merge pull request #1457 from reuk/reuk/testing-utils
Add new testing-utils library
2 parents 99eb662 + aacd436 commit 68e4d6b

31 files changed

+75
-39
lines changed

unit/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED true)
33

44
file(GLOB_RECURSE sources "*.cpp")
55
file(GLOB_RECURSE headers "*.h")
6+
7+
file(GLOB_RECURSE testing_utils "testing-utils/*.cpp" "testing-utils/*.h")
8+
69
list(REMOVE_ITEM sources
710
# Used in executables
811
${CMAKE_CURRENT_SOURCE_DIR}/miniBDD.cpp
@@ -22,18 +25,23 @@ list(REMOVE_ITEM sources
2225
${CMAKE_CURRENT_SOURCE_DIR}/float_utils.cpp
2326
${CMAKE_CURRENT_SOURCE_DIR}/ieee_float.cpp
2427

28+
# Will be built into a separate library and linked
29+
${testing_utils}
30+
2531
# Intended to fail to compile
2632
${CMAKE_CURRENT_SOURCE_DIR}/util/expr_cast/expr_undefined_casts.cpp
2733
)
2834

35+
add_subdirectory(testing-utils)
36+
2937
add_executable(unit ${sources} ${headers})
3038
target_include_directories(unit
3139
PUBLIC
3240
${CBMC_BINARY_DIR}
3341
${CBMC_SOURCE_DIR}
3442
${CMAKE_CURRENT_SOURCE_DIR}
3543
)
36-
target_link_libraries(unit ansi-c solvers java_bytecode)
44+
target_link_libraries(unit testing-utils ansi-c solvers java_bytecode)
3745
add_test(
3846
NAME unit
3947
COMMAND $<TARGET_FILE:unit>

unit/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
.PHONY: all cprover.dir test
22

33
# Source files for test utilities
4-
SRC = src/expr/require_expr.cpp \
5-
src/ansi-c/c_to_expr.cpp \
6-
src/java_bytecode/load_java_class.cpp \
7-
unit_tests.cpp \
4+
SRC = unit_tests.cpp \
85
catch_example.cpp \
96
util/expr_iterator.cpp \
107
util/optional.cpp \
@@ -42,6 +39,9 @@ include ../src/common
4239
cprover.dir:
4340
$(MAKE) $(MAKEARGS) -C ../src
4441

42+
testing-utils/testing-utils$(LIBEXT):
43+
$(MAKE) $(MAKEARGS) -C testing-utils
44+
4545
CPROVER_LIBS =../src/java_bytecode/java_bytecode$(LIBEXT) \
4646
../src/miniz/miniz$(OBJEXT) \
4747
../src/ansi-c/ansi-c$(LIBEXT) \
@@ -58,7 +58,7 @@ CPROVER_LIBS =../src/java_bytecode/java_bytecode$(LIBEXT) \
5858
../src/solvers/solvers$(LIBEXT) \
5959
# Empty last line
6060

61-
OBJ += $(CPROVER_LIBS)
61+
OBJ += $(CPROVER_LIBS) testing-utils/testing-utils$(LIBEXT)
6262

6363
TESTS = unit_tests$(EXEEXT) \
6464
miniBDD$(EXEEXT) \

unit/analyses/ai/ai_simplify_lhs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/// \file
1010
/// Unit tests for ai_domain_baset::ai_simplify_lhs
1111

12-
#include <catch.hpp>
12+
#include <testing-utils/catch.hpp>
1313

1414
#include <analyses/ai.h>
1515

unit/analyses/call_graph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Module: Unit test for call graph generation
88

99
#include <iostream>
1010

11-
#include <catch.hpp>
11+
#include <testing-utils/catch.hpp>
1212

1313
#include <analyses/call_graph.h>
1414

unit/analyses/does_remove_const/does_expr_lose_const.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/// \file
1010
/// Does Remove Const Unit Tests
1111

12-
#include <catch.hpp>
12+
#include <testing-utils/catch.hpp>
1313

1414
#include <util/std_expr.h>
1515
#include <util/std_code.h>

unit/analyses/does_remove_const/does_type_preserve_const_correctness.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/// \file
1010
/// Does Remove Const Unit Tests
1111

12-
#include <catch.hpp>
12+
#include <testing-utils/catch.hpp>
1313

1414
#include <util/c_types.h>
1515
#include <util/namespace.h>

unit/analyses/does_remove_const/is_type_at_least_as_const_as.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/// \file
1010
/// Does Remove Const Unit Tests
1111

12-
#include <catch.hpp>
12+
#include <testing-utils/catch.hpp>
1313

1414
#include <util/c_types.h>
1515
#include <util/namespace.h>

unit/catch_example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
\*******************************************************************/
88

9-
#include <catch.hpp>
9+
#include <testing-utils/catch.hpp>
1010

1111
unsigned int Factorial(unsigned int number)
1212
{

unit/java_bytecode/java_bytecode_convert_class/convert_abstract_class.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
\*******************************************************************/
88

9-
#include <catch.hpp>
9+
#include <testing-utils/catch.hpp>
1010

1111
#include <istream>
1212
#include <memory>
@@ -15,7 +15,7 @@
1515
#include <util/language.h>
1616
#include <util/message.h>
1717
#include <java_bytecode/java_bytecode_language.h>
18-
#include <src/java_bytecode/load_java_class.h>
18+
#include <testing-utils/load_java_class.h>
1919

2020
SCENARIO("java_bytecode_convert_abstract_class",
2121
"[core][java_bytecode][java_bytecode_convert_class]")

unit/java_bytecode/java_string_library_preprocess/convert_exprt_to_string_exprt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
\*******************************************************************/
99

10-
#include <catch.hpp>
10+
#include <testing-utils/catch.hpp>
1111
#include <util/c_types.h>
1212
#include <util/expr.h>
1313
#include <util/std_code.h>

0 commit comments

Comments
 (0)