2019-12-26 14:45:42 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "Misc/AutomationTest.h"
|
|
|
|
|
#include "Interfaces/IPv4/IPv4Address.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2016-02-01 14:57:29 -05:00
|
|
|
#if WITH_DEV_AUTOMATION_TESTS
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2016-01-19 09:54:25 -05:00
|
|
|
IMPLEMENT_SIMPLE_AUTOMATION_TEST(FIPv4AddressTest, "System.Engine.Networking.IPv4.IPv4Address", EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::SmokeFilter)
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FIPv4AddressTest::RunTest( const FString& Parameters )
|
|
|
|
|
{
|
|
|
|
|
// component access must be correct
|
|
|
|
|
FIPv4Address a1_1 = FIPv4Address(1, 2, 3, 4);
|
|
|
|
|
|
2016-01-19 09:54:25 -05:00
|
|
|
TestEqual<uint8>(TEXT("Component A of 1.2.3.4 must be 1"), a1_1.A, 1);
|
|
|
|
|
TestEqual<uint8>(TEXT("Component B of 1.2.3.4 must be 2"), a1_1.B, 2);
|
|
|
|
|
TestEqual<uint8>(TEXT("Component C of 1.2.3.4 must be 3"), a1_1.C, 3);
|
|
|
|
|
TestEqual<uint8>(TEXT("Component D of 1.2.3.4 must be 4"), a1_1.D, 4);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
// link local addresses must be recognized
|
|
|
|
|
FIPv4Address a2_1 = FIPv4Address(169, 254, 0, 1);
|
|
|
|
|
FIPv4Address a2_2 = FIPv4Address(168, 254, 0, 1);
|
|
|
|
|
FIPv4Address a2_3 = FIPv4Address(169, 253, 0, 1);
|
|
|
|
|
|
|
|
|
|
TestTrue(TEXT("169.254.0.1 must be a link local address"), a2_1.IsLinkLocal());
|
|
|
|
|
TestFalse(TEXT("168.254.0.1 must not be a link local address"), a2_2.IsLinkLocal());
|
|
|
|
|
TestFalse(TEXT("169.253.0.1 must not be a link local address"), a2_3.IsLinkLocal());
|
|
|
|
|
|
|
|
|
|
// loopback addresses must be recognized
|
|
|
|
|
FIPv4Address a3_1 = FIPv4Address(127, 0, 0, 1);
|
|
|
|
|
FIPv4Address a3_2 = FIPv4Address(128, 0, 0, 1);
|
|
|
|
|
|
|
|
|
|
TestTrue(TEXT("127.0.0.1 must be a loopback address"), a3_1.IsLoopbackAddress());
|
|
|
|
|
TestFalse(TEXT("128.0.0.1 must not be a loopback address"), a3_2.IsLoopbackAddress());
|
|
|
|
|
|
|
|
|
|
// multicast addresses must be recognized
|
|
|
|
|
FIPv4Address a4_1 = FIPv4Address(223, 255, 255, 255);
|
|
|
|
|
FIPv4Address a4_2 = FIPv4Address(224, 0, 0, 0);
|
|
|
|
|
FIPv4Address a4_3 = FIPv4Address(239, 255, 255, 255);
|
|
|
|
|
FIPv4Address a4_4 = FIPv4Address(240, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
TestFalse(TEXT("223.255.255.255 must not be a multicast address"), a4_1.IsMulticastAddress());
|
|
|
|
|
TestTrue(TEXT("224.0.0.0 must be a multicast address"), a4_2.IsMulticastAddress());
|
|
|
|
|
TestTrue(TEXT("239.255.255.255 must be a multicast address"), a4_3.IsMulticastAddress());
|
|
|
|
|
TestFalse(TEXT("240.0.0.0 must not be a multicast address"), a4_4.IsMulticastAddress());
|
|
|
|
|
|
|
|
|
|
// string conversion
|
|
|
|
|
FIPv4Address a5_1 = FIPv4Address(1, 2, 3, 4);
|
|
|
|
|
|
2016-01-19 09:54:25 -05:00
|
|
|
TestEqual<FString>(TEXT("String conversion (1.2.3.4)"), a5_1.ToString(), TEXT("1.2.3.4"));
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
// parsing valid strings must succeed
|
|
|
|
|
FIPv4Address a6_1 = FIPv4Address(1, 2, 3, 4);
|
|
|
|
|
FIPv4Address a6_2;
|
|
|
|
|
|
|
|
|
|
TestTrue(TEXT("Parsing valid strings must succeed (1.2.3.4)"), FIPv4Address::Parse(TEXT("1.2.3.4"), a6_2));
|
|
|
|
|
TestEqual(TEXT("Parsing valid strings must result in correct value (1.2.3.4)"), a6_2, a6_1);
|
|
|
|
|
|
|
|
|
|
// parsing invalid strings must fail
|
|
|
|
|
FIPv4Address a7_1;
|
|
|
|
|
|
2016-01-19 09:54:25 -05:00
|
|
|
TestFalse(TEXT("Parsing invalid strings must fail (empty)"), FIPv4Address::Parse(TEXT(""), a7_1));
|
|
|
|
|
// TestFalse(TEXT("Parsing invalid strings must fail (...)"), FIPv4Address::Parse(TEXT("..."), a7_1));
|
|
|
|
|
TestFalse(TEXT("Parsing invalid strings must fail (1.2.3)"), FIPv4Address::Parse(TEXT("1.2.3"), a7_1));
|
|
|
|
|
// TestFalse(TEXT("Parsing invalid strings must fail (1.2.3.)"), FIPv4Address::Parse(TEXT("1.2.3."), a7_1));
|
|
|
|
|
TestFalse(TEXT("Parsing invalid strings must fail (1.2.3.4.)"), FIPv4Address::Parse(TEXT("1.2.3.4."), a7_1));
|
|
|
|
|
TestFalse(TEXT("Parsing invalid strings must fail (.1.2.3.4)"), FIPv4Address::Parse(TEXT(".1.2.3.4"), a7_1));
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
// site local addresses must be recognized
|
|
|
|
|
FIPv4Address a8_1 = FIPv4Address(10, 0, 0, 1);
|
|
|
|
|
FIPv4Address a8_2 = FIPv4Address(172, 16, 0, 1);
|
2021-09-03 12:52:39 -04:00
|
|
|
FIPv4Address a8_3 = FIPv4Address(172, 31, 0, 1);
|
|
|
|
|
FIPv4Address a8_4 = FIPv4Address(192, 168, 0, 1);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
TestTrue(TEXT("10.0.0.1 must be a site local address"), a8_1.IsSiteLocalAddress());
|
|
|
|
|
TestTrue(TEXT("172.16.0.1 must be a site local address"), a8_2.IsSiteLocalAddress());
|
2021-09-03 12:52:39 -04:00
|
|
|
TestTrue(TEXT("172.31.0.1 must be a site local address"), a8_3.IsSiteLocalAddress());
|
|
|
|
|
TestTrue(TEXT("192.168.0.1 must be a site local address"), a8_4.IsSiteLocalAddress());
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2021-09-03 12:52:39 -04:00
|
|
|
FIPv4Address a8_5 = FIPv4Address(11, 0, 0, 1);
|
|
|
|
|
FIPv4Address a8_6 = FIPv4Address(173, 16, 0, 1);
|
|
|
|
|
FIPv4Address a8_7 = FIPv4Address(172, 32, 0, 1);
|
|
|
|
|
FIPv4Address a8_8 = FIPv4Address(193, 168, 0, 1);
|
|
|
|
|
FIPv4Address a8_9 = FIPv4Address(192, 169, 0, 1);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2021-09-03 12:52:39 -04:00
|
|
|
TestFalse(TEXT("11.0.0.1 must not be a site local address"), a8_5.IsSiteLocalAddress());
|
|
|
|
|
TestFalse(TEXT("173.16.0.1 must not be a site local address"), a8_6.IsSiteLocalAddress());
|
|
|
|
|
TestFalse(TEXT("172.32.0.1 must not be a site local address"), a8_7.IsSiteLocalAddress());
|
|
|
|
|
TestFalse(TEXT("193.168.0.1 must not be a site local address"), a8_8.IsSiteLocalAddress());
|
|
|
|
|
TestFalse(TEXT("192.169.0.1 must not be a site local address"), a8_9.IsSiteLocalAddress());
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2016-01-19 09:54:25 -05:00
|
|
|
// host byte order integer constructor
|
|
|
|
|
#if PLATFORM_LITTLE_ENDIAN
|
|
|
|
|
FIPv4Address a9_1(3232235521); // 192.168.0.1 in little-endian
|
|
|
|
|
#else
|
|
|
|
|
FIPv4Address a9_1(16820416); // 192.168.0.1 in big-endian
|
|
|
|
|
#endif
|
|
|
|
|
FIPv4Address a9_2(192, 168, 0, 1);
|
|
|
|
|
|
|
|
|
|
TestEqual<FIPv4Address>(TEXT("Host byte order constructor must yield correct components"), a9_1, a9_2);
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
return true;
|
2014-06-12 23:22:18 -04:00
|
|
|
}
|
2016-02-01 14:57:29 -05:00
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#endif //WITH_DEV_AUTOMATION_TESTS
|