This commit is contained in:
watrabi
2025-09-18 17:55:52 -04:00
commit 977f1ff4b8
15030 changed files with 17324420 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
#include "rbx/test/App.UnitTest.Lib.h"
#include <boost/test/unit_test.hpp>
#include "V8DataModel/ContentProvider.h"
#include "util/Statistics.h"
#include "rbx/Debug.h"
#include "boost/filesystem.hpp"
namespace fs = boost::filesystem;
namespace RBX {
extern bool nameThreads;
}
RBX::ProtectedString RBX::ProtectedString::fromTestSource(const std::string& stringRef)
{
return RBX::ProtectedString::fromTrustedSource(stringRef);
}
using namespace RBX::Test;
static bool setBaseUrl = false;
static bool setContentFolder = false;
AppGlobalFixture::AppGlobalFixture()
{
RBX::nameThreads = false;
if (!setBaseUrl)
// TODO: Is this right?
::SetBaseURL("www.watrbx.wtf");
if (!setContentFolder)
{
// TODO: Make this configurable?
fs::path path = fs::initial_path<fs::path>();
#ifdef _WIN32
// On Windows App.UnitTest is run from inside of Client/App.UnitTest/bin/Release folder
// working path above is pointing to Client
// Content folder is expected directory underneath the Client
path = path.parent_path();
path /= "Content";
#else
// On Mac App.UnitTest is run from inside of Client/build/Release folder
// working path above is pointing to Client/build
// Content folder is expected directory underneath the Client
path /= "content";
#endif
std::string filePath = path.string();
RBX::ContentProvider::setAssetFolder(filePath.c_str());
}
}
bool AppGlobalFixture::processArg( const std::string arg )
{
if (arg.find("--help") == 0)
{
std::cout << "ROBLOX custom arguments:\n";
std::cout << " --content_path=<dir> - directory to the Content folder. Can be absolute or relative\n";
std::cout << " --base_url=<url> - define the BaseUrl\n";
return false;
}
const char* contentFolderArg = "--content_path=";
if (arg.find(contentFolderArg) == 0)
{
std::string contentFolderValue = arg.substr(strlen(contentFolderArg));
fs::path contentPath = contentFolderValue;
if (!contentPath.has_root_path())
contentPath = fs::initial_path<fs::path>() / contentFolderValue;
RBX::ContentProvider::setAssetFolder(contentPath.string().c_str());
setContentFolder = true;
return true;
}
const char* baseUrlArg = "--base_url=";
if (arg.find(baseUrlArg) == 0)
{
std::string baseUrlValue = arg.substr(strlen(baseUrlArg));
::SetBaseURL(baseUrlValue.c_str());
setBaseUrl = true;
return true;
}
return false;
}
+184
View File
@@ -0,0 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{DE42A59C-DAEF-46E0-89DE-7CED362460E0}</ProjectGuid>
<RootNamespace>AppUnitTestLib</RootNamespace>
<SccProjectName>SAK</SccProjectName>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
<SccProvider>SAK</SccProvider>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v110_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;$(CONTRIB_PATH)\SDL2\include;.\include;$(CONTRIB_PATH)\boost_1_56_0\include;..\TBB_4_1\include;..\Base;..\Base\include;..\Base.UnitTest.Lib\include;..\App\include;..\App.BulletPhysics;..\App\util;..\Network;..\Network\include;..\Rendering;..\Rendering\AppDraw\include;..\Rendering\RbxG3D\include;..\Rendering\g3d\include;..\Rendering\g3d\png;..\Rendering\GfxBase\include;..\DeviceCaps\include;..\Network\raknet\Source;..\Log\include;..\ClientShared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_THREAD_BUILD_LIB;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;$(CONTRIB_PATH)\SDL2\include;.\include;$(CONTRIB_PATH)\boost_1_56_0\include;..\TBB_4_1\include;..\Base;..\Base\include;..\Base.UnitTest.Lib\include;..\App\include;..\App.BulletPhysics;..\App\util;..\Network;..\Network\include;..\Rendering;..\Rendering\AppDraw\include;..\Rendering\RbxG3D\include;..\Rendering\g3d\include;..\Rendering\g3d\png;..\Rendering\GfxBase\include;..\DeviceCaps\include;..\Network\raknet\Source;..\Log\include;..\ClientShared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_THREAD_BUILD_LIB;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalOptions>/D "_SECURE_SCL=0" %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>.;$(CONTRIB_PATH)\SDL2\include;.\include;$(CONTRIB_PATH)\boost_1_56_0\include;..\TBB_4_1\include;..\Base;..\Base\include;..\Base.UnitTest.Lib\include;..\App\include;..\App.BulletPhysics;..\App\util;..\Network;..\Network\include;..\Rendering;..\Rendering\AppDraw\include;..\Rendering\RbxG3D\include;..\Rendering\g3d\include;..\Rendering\g3d\png;..\Rendering\GfxBase\include;..\DeviceCaps\include;..\Network\raknet\Source;..\Log\include;..\ClientShared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_THREAD_BUILD_LIB;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<AdditionalOptions>/D "_SECURE_SCL=0" %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>.;$(CONTRIB_PATH)\SDL2\include;.\include;$(CONTRIB_PATH)\boost_1_56_0\include;..\TBB_4_1\include;..\Base;..\Base\include;..\Base.UnitTest.Lib\include;..\App\include;..\App.BulletPhysics;..\App\util;..\Network;..\Network\include;..\Rendering;..\Rendering\AppDraw\include;..\Rendering\RbxG3D\include;..\Rendering\g3d\include;..\Rendering\g3d\png;..\Rendering\GfxBase\include;..\DeviceCaps\include;..\Network\raknet\Source;..\Log\include;..\ClientShared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_THREAD_BUILD_LIB;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="App.UnitTest.Lib.cpp" />
<ClCompile Include="DataModelFixture.cpp" />
<ClCompile Include="Performance.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\rbx\test\App.UnitTest.Lib.h" />
<ClInclude Include="include\rbx\test\DataModelFixture.h" />
<ClInclude Include="include\rbx\test\Performance.h" />
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\App.BulletPhysics\App.BulletPhysics.vcxproj">
<Project>{c9285114-dcc1-4e90-aa76-f590cefb94c2}</Project>
</ProjectReference>
<ProjectReference Include="..\App\App.vcxproj">
<Project>{63db8347-940b-4a05-8975-6a6545c315dc}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\Base.UnitTest.Lib\Base.UnitTest.Lib.vcxproj">
<Project>{c5e89a79-bbc2-4ff3-80e1-69f5291f0c3c}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\Network\Network.vcxproj">
<Project>{9b9eb5c6-15d1-4765-bcc7-8a42f2c9f6cc}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="App.UnitTest.Lib.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Performance.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DataModelFixture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\rbx\test\App.UnitTest.Lib.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\rbx\test\DataModelFixture.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\rbx\test\Performance.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
</Project>
@@ -0,0 +1,602 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
1F28448C15E6FBD600120D64 /* Performance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52D3A1D614ED8D720033CC1E /* Performance.cpp */; };
1F28448D15E6FBD600120D64 /* App.UnitTest.Lib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52D3A51F14ED9A620033CC1E /* App.UnitTest.Lib.cpp */; };
1F28448F15E6FBD600120D64 /* libboost-d-1_55.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FA4049F15DC328F0088E24D /* libboost-d-1_55.a */; };
1FA404A015DC32A80088E24D /* libboost-d-1_55.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FA4049F15DC328F0088E24D /* libboost-d-1_55.a */; };
4281E6001980682C002F5A98 /* LuaVMDummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4281E5FF1980682C002F5A98 /* LuaVMDummy.cpp */; };
52D3A1D814ED8D720033CC1E /* Performance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52D3A1D614ED8D720033CC1E /* Performance.cpp */; };
52D3A52014ED9A620033CC1E /* App.UnitTest.Lib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52D3A51F14ED9A620033CC1E /* App.UnitTest.Lib.cpp */; };
9F26E37117CD8E6F003F653B /* DataModelFixture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F26E37017CD8E6F003F653B /* DataModelFixture.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
1F28448915E6FBD600120D64 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1FA4049715DC328F0088E24D /* boost.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = E79762DE12886ADD00CE6714;
remoteInfo = boost_static;
};
1F97D9DE15EC084E00993FF3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1FA4049715DC328F0088E24D /* boost.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 106B8D7D15E7217400C1FF6B;
remoteInfo = "Boost static iOS";
};
1FA4049C15DC328F0088E24D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1FA4049715DC328F0088E24D /* boost.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D2AAC09D05546B4700DB518D;
remoteInfo = boost;
};
1FA4049E15DC328F0088E24D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1FA4049715DC328F0088E24D /* boost.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = E79762DF12886ADD00CE6714;
remoteInfo = boost_static;
};
1FA404A115DC32BA0088E24D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1FA4049715DC328F0088E24D /* boost.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = E79762DE12886ADD00CE6714;
remoteInfo = boost_static;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
1F28449315E6FBD600120D64 /* libApp.UnitTest.iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libApp.UnitTest.iOS.a; sourceTree = BUILT_PRODUCTS_DIR; };
1FA4049715DC328F0088E24D /* boost.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = boost.xcodeproj; path = ../boostlibs/boost.xcodeproj; sourceTree = SOURCE_ROOT; };
4281E5FF1980682C002F5A98 /* LuaVMDummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LuaVMDummy.cpp; path = ../App/script/LuaVMDummy.cpp; sourceTree = "<group>"; };
52D3A1D614ED8D720033CC1E /* Performance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Performance.cpp; sourceTree = "<group>"; };
52D3A1D914ED8D920033CC1E /* App.UnitTest.Lib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = App.UnitTest.Lib.h; path = include/rbx/test/App.UnitTest.Lib.h; sourceTree = "<group>"; };
52D3A1DA14ED8D920033CC1E /* DataModelFixture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataModelFixture.h; path = include/rbx/test/DataModelFixture.h; sourceTree = "<group>"; };
52D3A1DB14ED8D920033CC1E /* Performance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Performance.h; path = include/rbx/test/Performance.h; sourceTree = "<group>"; };
52D3A51F14ED9A620033CC1E /* App.UnitTest.Lib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = App.UnitTest.Lib.cpp; sourceTree = "<group>"; };
9F26E37017CD8E6F003F653B /* DataModelFixture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataModelFixture.cpp; sourceTree = "<group>"; };
D2AAC046055464E500DB518D /* libApp.UnitTest.Lib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libApp.UnitTest.Lib.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
1F28448E15E6FBD600120D64 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1F28448F15E6FBD600120D64 /* libboost-d-1_55.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D289987405E68DCB004EDB86 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1FA404A015DC32A80088E24D /* libboost-d-1_55.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
08FB7794FE84155DC02AAC07 /* App.UnitTest.Lib */ = {
isa = PBXGroup;
children = (
1FA4049715DC328F0088E24D /* boost.xcodeproj */,
52D3A1D314ED8D580033CC1E /* Source */,
52D3A1D414ED8D5E0033CC1E /* Header */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = App.UnitTest.Lib;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
D2AAC046055464E500DB518D /* libApp.UnitTest.Lib.a */,
1F28449315E6FBD600120D64 /* libApp.UnitTest.iOS.a */,
);
name = Products;
sourceTree = "<group>";
};
1FA4049815DC328F0088E24D /* Products */ = {
isa = PBXGroup;
children = (
1FA4049D15DC328F0088E24D /* Boost_1_55.dylib */,
1FA4049F15DC328F0088E24D /* libboost-d-1_55.a */,
1F97D9DF15EC084E00993FF3 /* libBoost static iOS.a */,
);
name = Products;
sourceTree = "<group>";
};
52D3A1D314ED8D580033CC1E /* Source */ = {
isa = PBXGroup;
children = (
4281E5FF1980682C002F5A98 /* LuaVMDummy.cpp */,
9F26E37017CD8E6F003F653B /* DataModelFixture.cpp */,
52D3A51F14ED9A620033CC1E /* App.UnitTest.Lib.cpp */,
52D3A1D614ED8D720033CC1E /* Performance.cpp */,
);
name = Source;
sourceTree = "<group>";
};
52D3A1D414ED8D5E0033CC1E /* Header */ = {
isa = PBXGroup;
children = (
52D3A1D914ED8D920033CC1E /* App.UnitTest.Lib.h */,
52D3A1DA14ED8D920033CC1E /* DataModelFixture.h */,
52D3A1DB14ED8D920033CC1E /* Performance.h */,
);
name = Header;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
1F28448A15E6FBD600120D64 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
D2AAC043055464E500DB518D /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
1F28448715E6FBD600120D64 /* App.UnitTest.iOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1F28449015E6FBD600120D64 /* Build configuration list for PBXNativeTarget "App.UnitTest.iOS" */;
buildPhases = (
1F28448A15E6FBD600120D64 /* Headers */,
1F28448B15E6FBD600120D64 /* Sources */,
1F28448E15E6FBD600120D64 /* Frameworks */,
);
buildRules = (
);
dependencies = (
1F28448815E6FBD600120D64 /* PBXTargetDependency */,
);
name = App.UnitTest.iOS;
productName = App.UnitTest.Lib;
productReference = 1F28449315E6FBD600120D64 /* libApp.UnitTest.iOS.a */;
productType = "com.apple.product-type.library.static";
};
D2AAC045055464E500DB518D /* App.UnitTest.Lib */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "App.UnitTest.Lib" */;
buildPhases = (
D2AAC043055464E500DB518D /* Headers */,
D2AAC044055464E500DB518D /* Sources */,
D289987405E68DCB004EDB86 /* Frameworks */,
);
buildRules = (
);
dependencies = (
1FA404A215DC32BA0088E24D /* PBXTargetDependency */,
);
name = App.UnitTest.Lib;
productName = App.UnitTest.Lib;
productReference = D2AAC046055464E500DB518D /* libApp.UnitTest.Lib.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
};
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "App.UnitTest.Lib" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 08FB7794FE84155DC02AAC07 /* App.UnitTest.Lib */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 1FA4049815DC328F0088E24D /* Products */;
ProjectRef = 1FA4049715DC328F0088E24D /* boost.xcodeproj */;
},
);
projectRoot = "";
targets = (
D2AAC045055464E500DB518D /* App.UnitTest.Lib */,
1F28448715E6FBD600120D64 /* App.UnitTest.iOS */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
1F97D9DF15EC084E00993FF3 /* libBoost static iOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libBoost static iOS.a";
remoteRef = 1F97D9DE15EC084E00993FF3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1FA4049D15DC328F0088E24D /* Boost_1_55.dylib */ = {
isa = PBXReferenceProxy;
fileType = "compiled.mach-o.dylib";
path = Boost_1_55.dylib;
remoteRef = 1FA4049C15DC328F0088E24D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1FA4049F15DC328F0088E24D /* libboost-d-1_55.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libboost-d-1_55.a";
remoteRef = 1FA4049E15DC328F0088E24D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXSourcesBuildPhase section */
1F28448B15E6FBD600120D64 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1F28448C15E6FBD600120D64 /* Performance.cpp in Sources */,
1F28448D15E6FBD600120D64 /* App.UnitTest.Lib.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D2AAC044055464E500DB518D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4281E6001980682C002F5A98 /* LuaVMDummy.cpp in Sources */,
52D3A1D814ED8D720033CC1E /* Performance.cpp in Sources */,
52D3A52014ED9A620033CC1E /* App.UnitTest.Lib.cpp in Sources */,
9F26E37117CD8E6F003F653B /* DataModelFixture.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
1F28448815E6FBD600120D64 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = boost_static;
targetProxy = 1F28448915E6FBD600120D64 /* PBXContainerItemProxy */;
};
1FA404A215DC32BA0088E24D /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = boost_static;
targetProxy = 1FA404A115DC32BA0088E24D /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
1DEB91EC08733DB70010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = i386;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
include,
"$(CONTRIB_PATH)/boost_1_55_0/include",
../App/util/include,
../App/include,
../Base/include,
../Log/include,
../Rendering/g3d/include,
../Rendering/RbxG3D/include,
../Base.UnitTest.Lib/include,
../Network/include,
../Network,
../Rendering/AppDraw/include,
../Rendering,
../Network/raknet/Source,
../Rendering/GfxBase/include,
../App.BulletPhysics,
../ClientShared,
"$(CONTRIB_PATH)/SDL2/include",
);
INSTALL_PATH = /usr/local/lib;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = App.UnitTest.Lib;
SDKROOT = macosx;
VALID_ARCHS = i386;
};
name = Debug;
};
1DEB91ED08733DB70010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = i386;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
include,
"$(CONTRIB_PATH)/boost_1_55_0/include",
../App/util/include,
../App/include,
../Base/include,
../Log/include,
../Rendering/g3d/include,
../Rendering/RbxG3D/include,
../Base.UnitTest.Lib/include,
../Network/include,
../Network,
../Rendering/AppDraw/include,
../Rendering,
../Network/raknet/Source,
../Rendering/GfxBase/include,
../App.BulletPhysics,
../ClientShared,
"$(CONTRIB_PATH)/SDL2/include",
);
INSTALL_PATH = /usr/local/lib;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = App.UnitTest.Lib;
SDKROOT = macosx;
VALID_ARCHS = i386;
};
name = Release;
};
1DEB91F008733DB70010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = "_DEBUG=1";
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.8;
};
name = Debug;
};
1DEB91F108733DB70010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1";
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
PREBINDING = NO;
SDKROOT = macosx10.8;
};
name = Release;
};
1F28449115E6FBD600120D64 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = (
armv7,
armv6,
);
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
RBX_PLATFORM_IOS,
);
GCC_VERSION = com.apple.compilers.llvmgcc42;
HEADER_SEARCH_PATHS = (
include,
"$(CONTRIB_PATH)/boost_1_55_0/include",
../App/include,
../Base/include,
../Log/include,
../Rendering/g3d/include,
../Rendering/RbxG3D/include,
../Base.UnitTest.Lib/include,
../App.BulletPhysics,
);
INSTALL_PATH = /usr/local/lib;
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = App.UnitTest.iOS;
SDKROOT = iphoneos;
VALID_ARCHS = "armv7 armv6";
};
name = Debug;
};
1F28449215E6FBD600120D64 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = (
armv7,
armv6,
);
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
RBX_PLATFORM_IOS,
);
GCC_VERSION = com.apple.compilers.llvmgcc42;
HEADER_SEARCH_PATHS = (
include,
"$(CONTRIB_PATH)/boost_1_55_0/include",
../App/include,
../Base/include,
../Log/include,
../Rendering/g3d/include,
../Rendering/RbxG3D/include,
../Base.UnitTest.Lib/include,
../App.BulletPhysics,
);
INSTALL_PATH = /usr/local/lib;
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = App.UnitTest.iOS;
SDKROOT = iphoneos;
VALID_ARCHS = "armv7 armv6";
};
name = Release;
};
D0D04FCE1C75F42B00CDE19D /* NoOpt */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"NDEBUG=1",
"_NOOPT=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
PREBINDING = NO;
SDKROOT = macosx10.8;
};
name = NoOpt;
};
D0D04FCF1C75F42B00CDE19D /* NoOpt */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = i386;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
include,
"$(CONTRIB_PATH)/boost_1_55_0/include",
../App/util/include,
../App/include,
../Base/include,
../Log/include,
../Rendering/g3d/include,
../Rendering/RbxG3D/include,
../Base.UnitTest.Lib/include,
../Network/include,
../Network,
../Rendering/AppDraw/include,
../Rendering,
../Network/raknet/Source,
../Rendering/GfxBase/include,
../App.BulletPhysics,
../ClientShared,
"$(CONTRIB_PATH)/SDL2/include",
);
INSTALL_PATH = /usr/local/lib;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = App.UnitTest.Lib;
SDKROOT = macosx;
VALID_ARCHS = i386;
};
name = NoOpt;
};
D0D04FD01C75F42B00CDE19D /* NoOpt */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = (
armv7,
armv6,
);
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
RBX_PLATFORM_IOS,
);
GCC_VERSION = com.apple.compilers.llvmgcc42;
HEADER_SEARCH_PATHS = (
include,
"$(CONTRIB_PATH)/boost_1_55_0/include",
../App/include,
../Base/include,
../Log/include,
../Rendering/g3d/include,
../Rendering/RbxG3D/include,
../Base.UnitTest.Lib/include,
../App.BulletPhysics,
);
INSTALL_PATH = /usr/local/lib;
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = App.UnitTest.iOS;
SDKROOT = iphoneos;
VALID_ARCHS = "armv7 armv6";
};
name = NoOpt;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "App.UnitTest.Lib" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91EC08733DB70010E9CD /* Debug */,
1DEB91ED08733DB70010E9CD /* Release */,
D0D04FCF1C75F42B00CDE19D /* NoOpt */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "App.UnitTest.Lib" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91F008733DB70010E9CD /* Debug */,
1DEB91F108733DB70010E9CD /* Release */,
D0D04FCE1C75F42B00CDE19D /* NoOpt */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1F28449015E6FBD600120D64 /* Build configuration list for PBXNativeTarget "App.UnitTest.iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1F28449115E6FBD600120D64 /* Debug */,
1F28449215E6FBD600120D64 /* Release */,
D0D04FD01C75F42B00CDE19D /* NoOpt */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
}
+65
View File
@@ -0,0 +1,65 @@
#include "rbx/test/DataModelFixture.h"
#include "Client.h"
#include "ClientReplicator.h"
#include "Marker.h"
void NetworkFixture::startClient(DataModelFixture& dm, bool waitForClientToReceiveCharacter)
{
RBX::CEvent event(true);
{
RBX::Reflection::Tuple args(3);
args.values[0] = shared_ptr<RBX::Lua::GenericFunction>(new RBX::Lua::GenericFunction(boost::bind(&accepted, &event)));
args.values[1] = shared_ptr<RBX::Lua::GenericFunction>(new RBX::Lua::GenericFunction(boost::bind(&failed, _1, &event)));
args.values[2] = shared_ptr<RBX::Lua::GenericFunction>(new RBX::Lua::GenericFunction(boost::bind(&rejected, _1, &event)));
const char* clientScript = "accepted, failed, rejected = ...\n"\
"local nc = game:GetService('NetworkClient')\n"\
"nc.ConnectionAccepted:connect(accepted)\n"\
"nc.ConnectionFailed:connect(failed)\n"\
"nc.ConnectionRejected:connect(rejected)\n"\
"nc:PlayerConnect(0, 'localhost', 53640, 0, 0)\n";
RBX_REQUIRE_NO_EXECEPTION(dm.execute(clientScript, args));
}
// Raknet default timeout time is 10 or 30 seconds
BOOST_CHECK(event.Wait(RBX::Time::Interval::from_seconds(60)));
if (waitForClientToReceiveCharacter)
{
RBX::CEvent characterLoadedEvent(true);
//boost::shared_ptr<RBX::Network::Marker> marker;
{
RBX::DataModel::LegacyLock l(&dm, RBX::DataModelJob::Write);
RBX::Network::Client* client = RBX::ServiceProvider::find<RBX::Network::Client>(&dm);
RBXASSERT(client);
RBX::Network::ClientReplicator* replicator = client->findFirstChildOfType<RBX::Network::ClientReplicator>();
RBXASSERT(replicator);
RBX::Network::Players* players = RBX::ServiceProvider::find<RBX::Network::Players>(&dm);
RBXASSERT(players);
RBX::Network::Player* player = players->getLocalPlayer();
RBXASSERT(player);
RBX::Reflection::Tuple args(1);
args.values[0] = shared_ptr<RBX::Lua::GenericFunction>(new RBX::Lua::GenericFunction(boost::bind(&accepted, &characterLoadedEvent)));
// hack: doing this in script, because sometimes SendMarker returns bad memory in c++ (only observed here)
const char* requestCharacterScript ="success = ...\n"\
"local nc = game:GetService('NetworkClient')\n"\
"local replicator = nc:GetChildren()[1]\n"\
"local marker = replicator:SendMarker()\n"\
"marker.Received:connect(function() replicator:RequestCharacter() end)\n"\
"local waitTime = 0\n"\
"while waitTime < 60 do\n"\
" local t = wait(1)\n"\
" waitTime = waitTime + t\n"\
" if game.Players.LocalPlayer.Character ~= nil then success() break end\n"\
"end\n";
RBX_REQUIRE_NO_EXECEPTION(dm.execute(requestCharacterScript, args));
}
BOOST_REQUIRE(characterLoadedEvent.Wait(RBX::Time::Interval::from_seconds(60)));
}
}
+41
View File
@@ -0,0 +1,41 @@
#include "rbx/test/Performance.h"
#include <boost/test/unit_test.hpp>
#ifdef _WIN32
#include "Windows.h"
#elif defined(__APPLE__)
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
RBX::Test::Memory::Memory()
{
initialBytes = 0;
initialBytes = GetBytes();
}
long RBX::Test::Memory::GetBytes()
{
#ifdef _WIN32
MEMORYSTATUSEX status;
status.dwLength = sizeof(MEMORYSTATUSEX);
BOOST_REQUIRE(GlobalMemoryStatusEx(&status));
// This ain't pretty, but it is notoriously hard to get a good value for bytes used by a process:
return (long)status.ullTotalVirtual - (long)status.ullAvailVirtual - initialBytes;
#else
// "MACPORT: TBD for now, implementing something however we need to discuss how to handle this properly"
int mib[2];
uint64_t memsize;
size_t len;
mib[0] = CTL_HW;
mib[1] = HW_MEMSIZE; /*uint64_t: physical ram size */
len = sizeof(memsize);
sysctl(mib, 2, &memsize, &len, NULL, 0);
return (long)memsize;
#endif
}
+22
View File
@@ -0,0 +1,22 @@
========================================================================
STATIC LIBRARY : App.UnitTest.Lib Project Overview
========================================================================
AppWizard has created this App.UnitTest.Lib library project for you.
No source files were created as part of your project.
App.UnitTest.Lib.vcproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,19 @@
#include <boost/test/unit_test.hpp>
#include "rbx/test/Base.UnitTest.Lib.h"
namespace RBX {
namespace Test {
// Define this fixture in your project:
// BOOST_GLOBAL_FIXTURE(AppGlobalFixture);
class AppGlobalFixture
{
public:
AppGlobalFixture();
// returns true if the arg is processed
static bool processArg(const std::string arg);
};
}
}
@@ -0,0 +1,152 @@
#pragma once
// Helpful utility classes you can use to do DataModel-driven tests
#include "v8datamodel/datamodel.h"
#include "v8datamodel/factoryregistration.h"
#include "v8datamodel/GameSettings.h"
#include "v8datamodel/DebugSettings.h"
#include "v8datamodel/PhysicsSettings.h"
#include "v8datamodel/CommonVerbs.h"
#include "script/LuaSettings.h"
#include "Util/Http.h"
#include "Util/Profiling.h"
#include "Util/StandardOut.h"
#include "script/LuaSettings.h"
#include "script/ScriptContext.h"
#include "Network/API.h"
#include "Network/Players.h"
#include "rbx/test/test_tools.h"
#include "gui/ProfanityFilter.h"
// Use this fixture to create a DataModel
class DataModelFixture
{
static void init()
{
static boost::shared_ptr<RBX::ProfanityFilter> s_profanityFilter;
s_profanityFilter = RBX::ProfanityFilter::getInstance();
RBX::Profiling::init(false);
static RBX::FactoryRegistrator registerFactoryObjects;
// This is needed before you can instantiate a DataModel
RBX::Http::init(RBX::Http::WinHttp, RBX::Http::CookieSharingSingleProcessMultipleThreads);
RBX::GameSettings::singleton();
RBX::LuaSettings::singleton();
RBX::DebugSettings::singleton();
RBX::PhysicsSettings::singleton();
}
boost::scoped_ptr<RBX::CommonVerbs> commonVerbs;
public:
boost::shared_ptr<RBX::DataModel> dataModel;
RBX::DataModel* operator&() { return dataModel.get(); }
RBX::DataModel* operator->() { return dataModel.get(); }
std::auto_ptr<RBX::Reflection::Tuple> execute(const char* script, const RBX::Reflection::Tuple& args, RBX::Security::Identities identity = RBX::Security::CmdLine_);
std::auto_ptr<RBX::Reflection::Tuple> execute(const char* script)
{
RBX::Reflection::Tuple args;
return execute(script, args);
}
void run()
{
RBX::RunService* runService = RBX::ServiceProvider::create<RBX::RunService>(dataModel.get());
BOOST_REQUIRE(runService);
runService->run();
}
DataModelFixture()
{
static boost::once_flag flag = BOOST_ONCE_INIT;
boost::call_once(&init, flag);
dataModel = RBX::DataModel::createDataModel(true, new RBX::NullVerb(NULL,""), false);
{
RBX::DataModel::LegacyLock lock(dataModel.get(), RBX::DataModelJob::Write);
commonVerbs.reset(new RBX::CommonVerbs(dataModel.get()));
}
}
~DataModelFixture()
{
commonVerbs.reset();
RBX::DataModel::closeDataModel(dataModel);
}
};
class NetworkFixture
{
public:
NetworkFixture()
{
static boost::once_flag flag = BOOST_ONCE_INIT;
boost::call_once(&RBX::Network::initWithoutSecurity, flag);
}
static void startServer(DataModelFixture& dm)
{
const char* serverScript = "local ns = game:GetService('NetworkServer')\n"\
"ns:Start(53640, 0)\n";
RBX_REQUIRE_NO_EXECEPTION(dm.execute(serverScript));
}
static void startClient(DataModelFixture& dm, bool waitForClientToReceiveCharacter=false);
private:
static shared_ptr<RBX::Reflection::Tuple> accepted(RBX::CEvent* event)
{
//BOOST_TEST_MESSAGE("connection accepted");
event->Set();
return shared_ptr<RBX::Reflection::Tuple>();
};
static shared_ptr<RBX::Reflection::Tuple> failed(shared_ptr<const RBX::Reflection::Tuple> args, RBX::CEvent* event)
{
std::string reason = args->values[1].get<std::string>();
BOOST_TEST_MESSAGE(reason);
event->Set();
return shared_ptr<RBX::Reflection::Tuple>();
};
static shared_ptr<RBX::Reflection::Tuple> rejected(shared_ptr<const RBX::Reflection::Tuple> args, RBX::CEvent* event)
{
BOOST_TEST_MESSAGE("connection rejected");
event->Set();
return shared_ptr<RBX::Reflection::Tuple>();
};
};
// Use this fixture for debugging
class OutputLoggingFixture
{
rbx::signals::scoped_connection messageConnection;
static void print(const RBX::StandardOutMessage& message)
{
switch (message.type)
{
case RBX::MESSAGE_INFO:
std::cout << "RBX INFO: " << message.message << '\n';
break;
case RBX::MESSAGE_WARNING:
std::cout << "RBX WARNING: " << message.message << '\n';
break;
case RBX::MESSAGE_ERROR:
std::cout << "RBX ERROR: " << message.message << '\n';
break;
default:
std::cout << "RBX: " << message.message << '\n';
break;
}
}
public:
OutputLoggingFixture()
{
messageConnection = RBX::StandardOut::singleton()->messageOut.connect(&OutputLoggingFixture::print);
}
};
@@ -0,0 +1,11 @@
#pragma once
namespace RBX { namespace Test {
class Memory
{
long initialBytes;
public:
Memory();
long GetBytes();
};
}}