-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47e4bd0
commit 4ee581f
Showing
11 changed files
with
326 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
Language: Cpp | ||
BasedOnStyle: LLVM | ||
IndentWidth: 4 | ||
TabWidth: 4 | ||
UseTab: ForIndentation | ||
Standard: Cpp11 | ||
FixNamespaceComments: true | ||
NamespaceIndentation: All | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: Align | ||
AlignEscapedNewlines: DontAlign | ||
AlignTrailingComments: true | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: InlineOnly | ||
BreakConstructorInitializersBeforeComma: true | ||
RemoveSemicolon: true | ||
InsertBraces: true | ||
InsertNewlineAtEOF: true | ||
BreakBeforeBraces: Allman | ||
|
||
AllowShortLambdasOnASingleLine: Inline | ||
ColumnLimit: 0 | ||
PointerAlignment: Left | ||
SpaceAfterTemplateKeyword: false | ||
SpacesInAngles: false | ||
ContinuationIndentWidth: 4 | ||
IndentCaseLabels: true | ||
IncludeBlocks: Regroup | ||
IncludeCategories: | ||
- Regex: '.*\.generated\.h' | ||
Priority: 2 | ||
- Regex: '.*' | ||
Priority: 1 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
jobs: | ||
clang-format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DoozyX/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/.idea/ | ||
/Binaries/ | ||
/Intermediate/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
PROJECT_DIR="$(dirname "${BASH_SOURCE[0]}")" | ||
|
||
find "${PROJECT_DIR}" \( -name "*.h" -o -name "*.cpp" \) -print0 | xargs -0 -P "$(nproc)" -n 100 clang-format -i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Marat Radchenko | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "UEST.h" | ||
|
||
#include "Modules/ModuleManager.h" | ||
|
||
FUESTTestBase::FUESTTestBase(const FString& InName) | ||
: FAutomationTestBase(InName, false) | ||
{ | ||
} | ||
|
||
uint32 FUESTTestBase::GetRequiredDeviceNum() const | ||
{ | ||
return 1; | ||
} | ||
|
||
uint32 FUESTTestBase::GetTestFlags() const | ||
{ | ||
return EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::ProductFilter; | ||
} | ||
|
||
void FUESTTestBase::GetTests(TArray<FString>& OutBeautifiedNames, TArray<FString>& OutTestCommands) const | ||
{ | ||
OutBeautifiedNames.Add(GetBeautifiedTestName()); | ||
OutTestCommands.Add(FString()); | ||
} | ||
|
||
bool FUESTTestBase::RunTest(const FString& Parameters) | ||
{ | ||
DoTest(Parameters); | ||
return true; | ||
} | ||
|
||
IMPLEMENT_MODULE(FDefaultModuleImpl, UEST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "UEST.h" | ||
|
||
TEST_CLASS(UEST_TestClass) | ||
{ | ||
TEST_METHOD(Test1) | ||
{ | ||
ASSERT_THAT(true); | ||
} | ||
|
||
TEST_METHOD(Test2) | ||
{ | ||
ASSERT_THAT(true); | ||
} | ||
}; | ||
|
||
TEST(UEST_Test) | ||
{ | ||
ASSERT_THAT(true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#pragma once | ||
|
||
// These asserts are just a stub | ||
|
||
#define AssertThatMsgf(Expression, Message, ...) \ | ||
do \ | ||
{ \ | ||
if (!ensureAlwaysMsgf((Expression), TEXT(Message), ##__VA_ARGS__)) \ | ||
{ \ | ||
return; \ | ||
} \ | ||
} while (false) | ||
|
||
#define ASSERT_THAT(Expression) AssertThatMsgf(Expression, "expected expression to be true") | ||
|
||
class UEST_API FUESTTestBase : public FAutomationTestBase | ||
{ | ||
protected: | ||
FUESTTestBase(const FString& InName); | ||
|
||
virtual uint32 GetRequiredDeviceNum() const override; | ||
|
||
virtual uint32 GetTestFlags() const override; | ||
|
||
virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray<FString>& OutTestCommands) const override; | ||
|
||
virtual bool RunTest(const FString& Parameters) override; | ||
|
||
virtual void DoTest(const FString& Parameters) | ||
{ | ||
} | ||
}; | ||
|
||
template<typename TClass> | ||
struct TUESTInstantiator | ||
{ | ||
TUESTInstantiator() | ||
{ | ||
Instance = MakeUnique<TClass>(); | ||
} | ||
TUniquePtr<TClass> Instance; | ||
}; | ||
|
||
#define TEST_CLASS_WITH_BASE(ClassName, BaseClass, PrettyName) \ | ||
struct F##ClassName##Impl; \ | ||
struct F##ClassName : public BaseClass \ | ||
{ \ | ||
typedef BaseClass Super; \ | ||
F##ClassName() \ | ||
: Super(TEXT(#PrettyName)) \ | ||
{ \ | ||
} \ | ||
/* This using is needed so Rider understands that we are a runnable test */ \ | ||
using Super::RunTest; \ | ||
virtual FString GetBeautifiedTestName() const override \ | ||
{ \ | ||
return TEXT(#PrettyName); \ | ||
} \ | ||
virtual FString GetTestSourceFileName() const override \ | ||
{ \ | ||
return TEXT(__FILE__); \ | ||
} \ | ||
virtual int32 GetTestSourceFileLine() const override \ | ||
{ \ | ||
return __LINE__; \ | ||
} \ | ||
}; \ | ||
static TUESTInstantiator<F##ClassName##Impl> ClassName##Instantiator; \ | ||
struct F##ClassName##Impl : public F##ClassName | ||
|
||
#define TEST_WITH_BASE(TestName, BaseClass, PrettyName) \ | ||
TEST_CLASS_WITH_BASE(TestName, BaseClass, PrettyName) \ | ||
{ \ | ||
virtual void DoTest(const FString& Parameters) override; \ | ||
}; \ | ||
void F##TestName##Impl::DoTest(const FString& Parameters) | ||
|
||
/** | ||
* Simple macro for a test. | ||
* Usage: | ||
* | ||
* TEST(MyFancyTest) | ||
* { | ||
* // Test body goes here | ||
* ASSERT_THAT(...); | ||
* } | ||
*/ | ||
// TODO: Add proper support for variadics | ||
#define TEST(...) TEST_WITH_BASE(__VA_ARGS__, FUESTTestBase, __VA_ARGS__) | ||
|
||
/** | ||
* Declares a test class | ||
* Usage: | ||
* | ||
* TEST_CLASS(MyFancyTestClass) | ||
* { | ||
* TEST_METHOD(Method1) | ||
* { | ||
* // Test body goes here | ||
* ASSERT_THAT(...); | ||
* } | ||
* | ||
* TEST_METHOD(Method2) | ||
* { | ||
* // Test body goes here | ||
* ASSERT_THAT(...); | ||
* } | ||
* | ||
* // You can put helper fields or methods here | ||
* } | ||
*/ | ||
// TODO: Add proper support for variadics | ||
#define TEST_CLASS(...) TEST_CLASS_WITH_BASE(__VA_ARGS__, FUESTTestBase, __VA_ARGS__) | ||
|
||
// TODO: Add proper support for variadics | ||
// TODO: This is just a stub, we need to register method in test class | ||
#define TEST_METHOD(MethodName) void MethodName() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using UnrealBuildTool; | ||
|
||
public class UEST : ModuleRules | ||
{ | ||
public UEST(ReadOnlyTargetRules Target) : base(Target) | ||
{ | ||
PublicDependencyModuleNames.AddRange( | ||
new[] | ||
{ | ||
"Core", | ||
"CoreUObject", | ||
"Engine", | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"FileVersion": 3, | ||
"Version": 1, | ||
"VersionName": "1.0", | ||
"FriendlyName": "UEST", | ||
"Description": "A testing framework that does not suck", | ||
"Category": "", | ||
"CreatedBy": "Marat Radchenko", | ||
"CreatedByURL": "https://github.com/slonopotamus", | ||
"DocsURL": "https://github.com/slonopotamus/UEST", | ||
"MarketplaceURL": "", | ||
"CanContainContent": false, | ||
"Modules": [ | ||
{ | ||
"Name": "UEST", | ||
"Type": "Runtime", | ||
"LoadingPhase": "Default" | ||
} | ||
] | ||
} |