Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
las3_pub
/
predictable_parallel_patterns
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ee843f57
authored
Mar 15, 2019
by
FritzFlorian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cach2 testing support.
parent
6d03890c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
0 deletions
+47
-0
CMakeLists.txt
+9
-0
lib/pls/include/pls/library.h
+2
-0
lib/pls/src/library.cpp
+5
-0
test/CMakeLists.txt
+5
-0
test/example_tests.cpp
+23
-0
test/main.cpp
+3
-0
No files found.
CMakeLists.txt
View file @
ee843f57
...
...
@@ -25,4 +25,13 @@ add_subdirectory(extern/catch2)
# Include all internal subprojects (library, examples, testing).
add_subdirectory
(
lib/pls
)
# Include examples
add_subdirectory
(
app/playground
)
# Add optional tests
option
(
PACKAGE_TESTS
"Build the tests"
ON
)
if
(
PACKAGE_TESTS
)
enable_testing
()
add_subdirectory
(
test
)
add_test
(
NAME AllTests COMMAND tests
)
endif
()
lib/pls/include/pls/library.h
View file @
ee843f57
...
...
@@ -3,6 +3,7 @@
namespace
pls
{
void
hello
();
int
test_adder
(
int
a
,
int
b
);
}
#endif
\ No newline at end of file
lib/pls/src/library.cpp
View file @
ee843f57
...
...
@@ -6,4 +6,8 @@ namespace pls {
void
hello
()
{
std
::
cout
<<
"Hello from PLS!"
<<
std
::
endl
;
}
int
test_adder
(
int
a
,
int
b
)
{
return
a
+
b
;
}
}
\ No newline at end of file
test/CMakeLists.txt
0 → 100644
View file @
ee843f57
add_executable
(
tests
main.cpp
example_tests.cpp
)
target_link_libraries
(
tests catch2 pls
)
\ No newline at end of file
test/example_tests.cpp
0 → 100644
View file @
ee843f57
#include <catch.hpp>
#include <pls/library.h>
// BDD style
SCENARIO
(
"the test_adder works"
,
"[library]"
)
{
GIVEN
(
"two numbers"
)
{
WHEN
(
"they are positive"
)
{
THEN
(
"the result is positive"
)
{
REQUIRE
(
pls
::
test_adder
(
1
,
2
)
>=
0
);
}
THEN
(
"the result is the sum of both"
)
{
REQUIRE
(
pls
::
test_adder
(
1
,
4
)
==
5
);
}
}
}
}
// Normal Style
TEST_CASE
(
"the test_adder can sumup"
,
"[libray]"
)
{
}
\ No newline at end of file
test/main.cpp
0 → 100644
View file @
ee843f57
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment