Skip to content

Commit bd281b5

Browse files
committed
finish "step10":exercise 1
1 parent 1a43c1c commit bd281b5

4 files changed

Lines changed: 26 additions & 18 deletions

File tree

‎Step10/SimpleTest/CMakePresets.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"binaryDir": "${sourceDir}/build",
99
"installDir": "${sourceParentDir}/install",
1010
"cacheVariables": {
11+
"CMAKE_CXX_COMPILER":"g++-13",
12+
"CMAKE_EXPORT_COMPILE_COMMANDS":"ON",
13+
1114
"CMAKE_CXX_STANDARD": "20",
1215
"CMAKE_PREFIX_PATH": "${sourceParentDir}/install"
1316
}

‎Step10/TutorialProject/CMakePresets.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"description": "Preset to use with the tutorial",
88
"binaryDir": "${sourceDir}/build",
99
"cacheVariables": {
10-
"TODO4": "Add ${sourceParentDir}/install to CMAKE_PREFIX_PATH",
10+
"CMAKE_CXX_COMPILER":"g++-13",
11+
"CMAKE_EXPORT_COMPILE_COMMANDS":"ON",
12+
13+
"CMAKE_PREFIX_PATH": "${sourceParentDir}/install",
1114
"TUTORIAL_USE_STD_SQRT": "OFF",
1215
"TUTORIAL_ENABLE_IPO": "OFF"
1316
}

‎Step10/TutorialProject/Tests/CMakeLists.txt‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,26 @@ target_sources(TestMathFunctions
77

88
# TODO1: Find the SimpleTest package. This should be a required dependency when
99
# building tests.
10-
10+
find_package(SimpleTest REQUIRED)
1111
# TODO2: Add the SimpleTest::SimpleTest target to Test MathFunctions
1212

1313
target_link_libraries(TestMathFunctions
1414
PRIVATE
1515
MathFunctions
16+
SimpleTest::SimpleTest
1617
)
1718

1819
# TODO3: Replace MathFunctionTest and all the calls to it with
1920
# simpletest_discover_tests called on TestMathFunctions
21+
simpletest_discover_tests(TestMathFunctions)
22+
# function(MathFunctionTest op)
23+
# add_test(
24+
# NAME ${op}
25+
# COMMAND TestMathFunctions ${op}
26+
# )
27+
# endfunction()
2028

21-
function(MathFunctionTest op)
22-
add_test(
23-
NAME ${op}
24-
COMMAND TestMathFunctions ${op}
25-
)
26-
endfunction()
27-
28-
MathFunctionTest(add)
29-
MathFunctionTest(mul)
30-
MathFunctionTest(sqrt)
31-
MathFunctionTest(sub)
29+
# MathFunctionTest(add)
30+
# MathFunctionTest(mul)
31+
# MathFunctionTest(sqrt)
32+
# MathFunctionTest(sub)

‎Step10/TutorialProject/Tests/TestMathFunctions.cxx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#include <MathFunctions.h>
22

33
// TODO5: Replace the following 5 lines with #include <SimpleTest.h>
4-
#define TEST(x) namespace
5-
#define REQUIRE(x)
6-
int main()
7-
{
8-
}
4+
// #define TEST(x) namespace
5+
// #define REQUIRE(x)
6+
// int main()
7+
// {
8+
// }
9+
#include <SimpleTest.h>
910

1011
TEST("add")
1112
{

0 commit comments

Comments
 (0)