test: add testbench for macro namespace

This commit is contained in:
2025-08-15 16:55:39 +08:00
parent 2f11ba6023
commit dfc0c127c5
7 changed files with 107 additions and 6 deletions

View File

@ -0,0 +1,20 @@
#include <gtest/gtest.h>
#include <yycc.hpp>
#include <yycc/macro/compiler_detector.hpp>
#define COMPILER ::yycc::macro::compiler
namespace yycctest::macro::compiler {
TEST(MacroCompiler, Main) {
auto rv = COMPILER::get_compiler();
#if defined(YYCC_CC_MSVC)
EXPECT_EQ(rv, COMPILER::CompilerKind::Msvc);
#elif defined(YYCC_CC_GCC)
EXPECT_EQ(rv, COMPILER::CompilerKind::Gcc);
#else
EXPECT_EQ(rv, COMPILER::CompilerKind::Clang);
#endif
}
} // namespace yycctest::macro::compiler