#include "LibcTest.h"
#include "include/llvm-libc-macros/stdfix-macros.h"
#include "src/__support/CPP/string.h"
#include "src/__support/CPP/string_view.h"
#include "src/__support/fixed_point/fx_rep.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
#include "src/__support/uint128.h"
#include "test/UnitTest/TestLogger.h"
#if __STDC_HOSTED__
#include <time.h>
#define LIBC_TEST_USE_CLOCK
#elif defined(TARGET_SUPPORTS_CLOCK)
#include <time.h>
#include "src/time/clock.h"
extern "C" clock_t clock() noexcept { return LIBC_NAMESPACE::clock(); }
#define LIBC_TEST_USE_CLOCK
#endif
namespace LIBC_NAMESPACE_DECL {
namespace testing {
namespace internal {
TestLogger &operator<<(TestLogger &logger, Location Loc) { … }
template <typename T>
cpp::enable_if_t<(cpp::is_integral_v<T> && (sizeof(T) > sizeof(uint64_t))) ||
is_big_int_v<T>,
cpp::string>
describeValue(T Value) { … }
template <typename T>
cpp::enable_if_t<cpp::is_integral_v<T> && (sizeof(T) <= sizeof(uint64_t)),
cpp::string>
describeValue(T Value) { … }
#ifdef LIBC_COMPILER_HAS_FIXED_POINT
template <typename T>
cpp::enable_if_t<cpp::is_fixed_point_v<T>, cpp::string> describeValue(T Value) {
using FXRep = fixed_point::FXRep<T>;
using comp_t = typename FXRep::CompType;
return cpp::to_string(cpp::bit_cast<comp_t>(Value)) + " * 2^-" +
cpp::to_string(FXRep::FRACTION_LEN);
}
#endif
cpp::string_view describeValue(const cpp::string &Value) { … }
cpp::string_view describeValue(cpp::string_view Value) { … }
template <typename ValType>
bool test(RunContext *Ctx, TestCond Cond, ValType LHS, ValType RHS,
const char *LHSStr, const char *RHSStr, Location Loc) { … }
}
Test *Test::Start = …;
Test *Test::End = …;
int argc = …;
char **argv = …;
char **envp = …;
RunContext;
void Test::addTest(Test *T) { … }
int Test::getNumTests() { … }
int Test::runTests(const TestOptions &Options) { … }
internal
bool Test::testStrEq(const char *LHS, const char *RHS, const char *LHSStr,
const char *RHSStr, internal::Location Loc) { … }
bool Test::testStrNe(const char *LHS, const char *RHS, const char *LHSStr,
const char *RHSStr, internal::Location Loc) { … }
bool Test::testMatch(bool MatchResult, MatcherBase &Matcher, const char *LHSStr,
const char *RHSStr, internal::Location Loc) { … }
}
}