test: add testbench for macro namespace
This commit is contained in:
20
testbench/yycc/macro/compiler_detector.cpp
Normal file
20
testbench/yycc/macro/compiler_detector.cpp
Normal 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
|
Reference in New Issue
Block a user