feat(linear-static-3d-euler-beam): step 7 - cmake-test-foundation

This commit is contained in:
KOKO\Mimi
2026-08-09 04:45:07 +09:00
parent cbce387a8c
commit db35297c53
8 changed files with 218 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
include(GoogleTest)
add_executable(
fesa_unit_tests
unit/build_info_test.cpp
)
target_link_libraries(
fesa_unit_tests
PRIVATE
fesa_solver
GTest::gtest_main
)
gtest_discover_tests(
fesa_unit_tests
PROPERTIES
LABELS "linear-static-3d-euler-beam;unit"
)
add_custom_target(fesa_tests DEPENDS fesa_unit_tests)
+27
View File
@@ -0,0 +1,27 @@
#include "fesa/build_info.hpp"
#include <gtest/gtest.h>
#include <regex>
#include <string>
#include <string_view>
#include <type_traits>
TEST(BuildInfo, VersionIsStableAndNonEmpty) {
const std::string_view first = fesa::solverVersion();
const std::string_view second = fesa::solverVersion();
EXPECT_FALSE(first.empty());
EXPECT_EQ(first, second);
EXPECT_TRUE(std::regex_match(
std::string(first), std::regex{R"(^[0-9]+\.[0-9]+\.[0-9]+$)"}));
}
TEST(BuildInfo, PublicHeaderHasNoBackendDependency) {
static_assert(
std::is_same_v<decltype(fesa::solverVersion()), std::string_view>,
"The public BuildInfo API must use only a standard-library value type.");
static_assert(noexcept(fesa::solverVersion()));
SUCCEED();
}