llvm/libc/test/UnitTest/TestLogger.cpp

#include "test/UnitTest/TestLogger.h"
#include "src/__support/CPP/string.h"
#include "src/__support/CPP/string_view.h"
#include "src/__support/OSUtil/io.h"               // write_to_stderr
#include "src/__support/big_int.h"                 // is_big_int
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
#include "src/__support/uint128.h"

#include <stdint.h>

namespace LIBC_NAMESPACE_DECL {
namespace testing {

// cpp::string_view specialization
template <>
TestLogger &TestLogger::operator<< <cpp::string_view>(cpp::string_view str) {}

// cpp::string specialization
template <> TestLogger &TestLogger::operator<< <cpp::string>(cpp::string str) {}

// const char* specialization
template <> TestLogger &TestLogger::operator<< <const char *>(const char *str) {}

// char* specialization
template <> TestLogger &TestLogger::operator<< <char *>(char *str) {}

// char specialization
template <> TestLogger &TestLogger::operator<<(char ch) {}

// bool specialization
template <> TestLogger &TestLogger::operator<<(bool cond) {}

// void * specialization
template <> TestLogger &TestLogger::operator<<(void *addr) {}

template <typename T> TestLogger &TestLogger::operator<<(T t) {}

// is_integral specializations
// char is already specialized to handle character
template TestLogger &TestLogger::operator<< <short>(short);
template TestLogger &TestLogger::operator<< <int>(int);
template TestLogger &TestLogger::operator<< <long>(long);
template TestLogger &TestLogger::operator<< <long long>(long long);
template TestLogger &TestLogger::operator<< <unsigned char>(unsigned char);
template TestLogger &TestLogger::operator<< <unsigned short>(unsigned short);
template TestLogger &TestLogger::operator<< <unsigned int>(unsigned int);
template TestLogger &TestLogger::operator<< <unsigned long>(unsigned long);
template TestLogger &
    TestLogger::operator<< <unsigned long long>(unsigned long long);

#ifdef LIBC_TYPES_HAS_INT128
template TestLogger &TestLogger::operator<< <__uint128_t>(__uint128_t);
#endif // LIBC_TYPES_HAS_INT128
template TestLogger &TestLogger::operator<< <UInt<128>>(UInt<128>);
template TestLogger &TestLogger::operator<< <UInt<192>>(UInt<192>);
template TestLogger &TestLogger::operator<< <UInt<256>>(UInt<256>);
template TestLogger &TestLogger::operator<< <UInt<320>>(UInt<320>);

// TODO: Add floating point formatting once it's supported by StringStream.

TestLogger tlog;

} // namespace testing
} // namespace LIBC_NAMESPACE_DECL