28 lines
777 B
C++
28 lines
777 B
C++
#include "fesa/build_info.h"
|
|
|
|
#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();
|
|
}
|