Skip to content

Commit

Permalink
Add more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
slonopotamus committed Aug 5, 2024
1 parent 91cd0ed commit e4aa7f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This project aims to provide a testing framework for Unreal Engine that does not
* Extensibility
* Async execution support
* IDE and CI first-class support
* User-visible API ergonomics is more important than internal implementation

== Dependencies

Expand Down Expand Up @@ -105,13 +106,19 @@ TEST(MyGame, SimpleMultiplayerTest)
{
auto Tester = FScopedGame().Create();
// You can create dedicated server
// You can create a dedicated server
UGameInstance* Server = Tester.CreateGame(EScopedGameType::DedicatedServer, TEXT("/Engine/Maps/Entry"));
// You can connect a client to it
UGameInstance* Client = Tester.CreateClientFor(Server);
ASSERT_THAT(Client, Is::Not::Null);
// Actually, you can connect as many clients as you want!
for (int32 Index = 0; Index < 10; ++Index)
{
Tester.CreateClientFor(Server);
}
// You can access game worlds
UWorld* ServerWorld = Server->GetWorld();
ASSERT_THAT(ServerWorld, Is::Not::Null);
Expand Down
8 changes: 7 additions & 1 deletion Source/UEST/Private/ScopedGameTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ TEST(UEST, ScopedGame, Simple)
{
auto Tester = FScopedGame().Create();

// You can create dedicated server
// You can create a dedicated server
UGameInstance* Server = Tester.CreateGame(EScopedGameType::DedicatedServer, TEXT("/Engine/Maps/Entry"));

// You can connect a client to it
UGameInstance* Client = Tester.CreateClientFor(Server);
ASSERT_THAT(Client, Is::Not::Null);

// Actually, you can connect as many clients as you want!
for (int32 Index = 0; Index < 10; ++Index)
{
Tester.CreateClientFor(Server);
}

// You can access game worlds
UWorld* ServerWorld = Server->GetWorld();
ASSERT_THAT(ServerWorld, Is::Not::Null);
Expand Down

0 comments on commit e4aa7f3

Please sign in to comment.