Skip to content
Snippets Groups Projects
Commit 6340e047 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add tests for SourceLocation

parent 2fbcc0a5
No related branches found
No related tags found
1 merge request!199Integrate checkpointing
......@@ -144,6 +144,7 @@ add_executable (unit_tests
test_SmallVector.cpp
test_Socket.cpp
test_SocketModule.cpp
test_SourceLocation.cpp
test_SquareGaussQuadrature.cpp
test_SquareTransformation.cpp
test_SymbolTable.cpp
......
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_all.hpp>
#include <utils/SourceLocation.hpp>
// clazy:excludeall=non-pod-global-static
TEST_CASE("SourceLocation", "[utils]")
{
SECTION("provided")
{
SourceLocation source_location("filename", 3, 2, "function_name");
REQUIRE(source_location.filename() == "filename");
REQUIRE(source_location.line() == 3);
REQUIRE(source_location.column() == 2);
REQUIRE(source_location.function() == "function_name");
}
SECTION("from std::source_location")
{
auto std_source_location = std::experimental::source_location::current();
SourceLocation source_location(std_source_location);
REQUIRE(source_location.filename() == std_source_location.file_name());
REQUIRE(source_location.line() == std_source_location.line());
REQUIRE(source_location.column() == std_source_location.column());
REQUIRE(source_location.function() == std_source_location.function_name());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment