-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding a test hierarchy skeleton with ctest automation
- Loading branch information
1 parent
bffca39
commit ddf5e9b
Showing
4 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(example) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
file (GLOB SRCS "./*.cpp") | ||
|
||
# Universal is a C++ header-only library, so we do not need to build anything | ||
include_directories(${STARTER_ROOT_DIR}/ext/stillwater-sc/universal/include) | ||
|
||
# create a ctest target for every individual cpp file in this directory | ||
compile_all("true" "testprefix" "Tests/example" "${SRCS}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <iostream> | ||
#include <iomanip> | ||
|
||
#include <universal/number/edecimal/edecimal.hpp> | ||
|
||
int main(int argc, char** argv) | ||
try { | ||
using namespace sw::universal; | ||
edecimal d, e, f; | ||
|
||
e = 1.0f; | ||
f = 0xFFFF'FFFF'FFFF'FFFFull; | ||
d = e + f; | ||
|
||
std::cout << d << std::endl; | ||
|
||
return EXIT_SUCCESS; | ||
|
||
} | ||
catch (const char* msg) { | ||
std::cerr << msg << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const sw::universal::universal_arithmetic_exception& err) { | ||
std::cerr << "Unprocessed universal arithmetic exception: " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const sw::universal::universal_internal_exception& err) { | ||
std::cerr << "Unprocessed universal internal exception: " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (...) { | ||
std::cerr << "Caught unknown exception" << std::endl; | ||
return EXIT_FAILURE; | ||
} |