Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
slonopotamus committed Aug 4, 2024
1 parent 669ce63 commit 7d4fbcf
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions Source/UEST/Public/UEST.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace UEST
static constexpr struct Null
{
template<typename T>
requires std::is_pointer_v<T> || std::is_null_pointer_v<T>
requires std::is_pointer_v<T> || std::is_null_pointer_v<T>
struct Matcher final : IMatcher<T>
{
virtual bool Matches(const T& Value) const override
Expand All @@ -44,7 +44,7 @@ namespace UEST
static constexpr struct True
{
template<typename T>
requires std::same_as<T, bool>
requires std::same_as<T, bool>
struct Matcher final : IMatcher<T>
{
virtual bool Matches(const T& Value) const override
Expand All @@ -68,7 +68,7 @@ namespace UEST
static constexpr struct False
{
template<typename T>
requires std::same_as<T, bool>
requires std::same_as<T, bool>
struct Matcher final : IMatcher<T>
{
virtual bool Matches(const T& Value) const override
Expand Down Expand Up @@ -96,7 +96,7 @@ namespace UEST
const T& Expected;

EqualTo(const T& Expected)
: Expected(Expected)
: Expected(Expected)
{
}

Expand All @@ -118,7 +118,7 @@ namespace UEST
const T& Expected;

LessThan(const T& Expected)
: Expected(Expected)
: Expected(Expected)
{
}

Expand All @@ -140,7 +140,7 @@ namespace UEST
const T& Expected;

LessThanOrEqual(const T& Expected)
: Expected(Expected)
: Expected(Expected)
{
}

Expand All @@ -162,7 +162,7 @@ namespace UEST
const T& Expected;

GreaterThan(const T& Expected)
: Expected(Expected)
: Expected(Expected)
{
}

Expand All @@ -184,7 +184,7 @@ namespace UEST
const T& Expected;

GreaterThanOrEqual(const T& Expected)
: Expected(Expected)
: Expected(Expected)
{
}

Expand All @@ -209,8 +209,9 @@ namespace UEST
Not() = default;

Not(M&& Nested)
: Nested(MoveTemp(Nested))
{}
: Nested(MoveTemp(Nested))
{
}

virtual bool Matches(const T& Value) const override
{
Expand All @@ -222,25 +223,26 @@ namespace UEST
return FString::Printf(TEXT("not %s"), *Nested.Describe());
}
};
}
} // namespace Matchers

template <typename M, typename... P>
template<typename M, typename... P>
// TODO: Add requires
struct Passthrough
{
M Matcher;

explicit Passthrough(const P&... Args)
: Matcher{Args...}
{}
: Matcher{Args...}
{
}

template<typename U>
auto operator()() const
{
return Matcher;
}
};
}
} // namespace UEST

namespace Is
{
Expand Down Expand Up @@ -306,8 +308,8 @@ namespace Is

template<typename T>
using GreaterThanOrEqual = UEST::Passthrough<UEST::Matchers::LessThan<T>, T>;
}
}
} // namespace Not
} // namespace Is

#define ASSERT_THAT(Value, Matcher) \
do \
Expand Down Expand Up @@ -383,11 +385,13 @@ struct TUESTInstantiator

#define TEST_CLASS_WITH_BASE_IMPL(BaseClass, ClassName, PrettyName) \
struct BOOST_PP_CAT(F, BOOST_PP_CAT(ClassName, Impl)); \
struct BOOST_PP_CAT(F, ClassName) : public BaseClass \
struct BOOST_PP_CAT(F, ClassName) \
: public BaseClass \
{ \
typedef BOOST_PP_CAT(F, BOOST_PP_CAT(ClassName, Impl)) ThisClass; \
typedef BaseClass Super; \
BOOST_PP_CAT(F, ClassName)() \
BOOST_PP_CAT(F, ClassName) \
() \
: Super(TEXT(PrettyName)) \
{ \
} \
Expand All @@ -407,7 +411,8 @@ struct TUESTInstantiator
} \
}; \
static TUESTInstantiator<BOOST_PP_CAT(F, BOOST_PP_CAT(ClassName, Impl))> BOOST_PP_CAT(ClassName, Instantiator); \
struct BOOST_PP_CAT(F, BOOST_PP_CAT(ClassName, Impl)) : public BOOST_PP_CAT(F, ClassName)
struct BOOST_PP_CAT(F, BOOST_PP_CAT(ClassName, Impl)) \
: public BOOST_PP_CAT(F, ClassName)

#define TEST_CLASS_WITH_BASE(BaseClass, ...) TEST_CLASS_WITH_BASE_IMPL(BaseClass, UEST_CLASS_NAME(__VA_ARGS__), UEST_PRETTY_NAME(__VA_ARGS__))

Expand Down Expand Up @@ -453,5 +458,6 @@ struct TUESTInstantiator
*/
#define TEST_CLASS(...) TEST_CLASS_WITH_BASE(FUESTTestBase, __VA_ARGS__)

#define TEST_METHOD(MethodName) FUESTMethodRegistrar reg##MethodName{TEXT(#MethodName), *this, FSimpleDelegate::CreateRaw(this, &ThisClass::MethodName)}; \
void MethodName()
#define TEST_METHOD(MethodName) \
FUESTMethodRegistrar reg##MethodName{TEXT(#MethodName), *this, FSimpleDelegate::CreateRaw(this, &ThisClass::MethodName)}; \
void MethodName()

0 comments on commit 7d4fbcf

Please sign in to comment.