#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();
}
