Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ version #5

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b510811
* C++ version.
amoldeshpande Dec 8, 2020
5a485b3
fix bug that was causing adventure to not work.
amoldeshpande Dec 8, 2020
f35a3a5
remove windows-specific console code. doesn't need windows.h anymore …
amoldeshpande Dec 8, 2020
2dbaef0
-(WIP) Make it easier to replace STL types with custom types. Useful …
amoldeshpande Dec 8, 2020
63f948e
* everything except std::function wrapped. Will need to test in a UE4…
amoldeshpande Dec 9, 2020
7cd6291
Merge pull request #1 from accesshoops/stl-replace
amoldeshpande Dec 11, 2020
8baccff
add USING_CUSTOM_STL check
amoldeshpande Dec 11, 2020
f8d68f2
fix typo
amoldeshpande Dec 11, 2020
f59c585
fix typo
amoldeshpande Dec 11, 2020
eed839c
Make a Contains() function because UE4 TSet does not have iterators e…
amoldeshpande Dec 11, 2020
a2752ad
Template conversion (#2)
amoldeshpande Dec 16, 2020
3d997e0
Vector replacement (#3)
amoldeshpande Dec 23, 2020
3da981e
Replace rand (#4)
amoldeshpande Dec 23, 2020
6043129
UE4 wants this function to return a value.
amoldeshpande Jan 4, 2021
a3fc8e2
Merge branch 'ptrefall:master' into master
amoldeshpande Jun 7, 2021
b57ca96
update with upstream changes
amoldeshpande Jun 7, 2021
024f75a
added logging setting
amoldeshpande Jun 10, 2021
2be12de
missing edit
amoldeshpande Jun 11, 2021
ab828f7
add Dequeue to queue type
amoldeshpande Jun 19, 2021
3f0c353
set ctx to dirty first
amoldeshpande Jun 19, 2021
f5f4b3e
that didn't work out so well
amoldeshpande Jun 21, 2021
d1c70f8
bring realtime logging over from standalone branch
amoldeshpande Jun 22, 2021
911bc24
1. Fixed error code in BaseDomainBuilder.h (#5)
kaminaritukane Dec 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
BasedOnStyle: Microsoft
AccessModifierOffset : -4
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: true
#AllowShortFunctionsOnASingleLine: Inline
AllowShortFunctionsOnASingleLine: InlineOnly
AlwaysBreakTemplateDeclarations : true
BreakBeforeBraces: Custom
BraceWrapping :
AfterEnum : true
AfterCaseLabel : true
BreakConstructorInitializers: BeforeComma
ColumnLimit: 132
#IndentCaseBlocks: 'true'
IndentCaseLabels: 'true'
PointerAlignment: Left
UseTab : 'Never'

SortIncludes : false

AlignAfterOpenBracket: Align
AllowAllArgumentsOnNextLine: false
BinPackParameters : false
BinPackArguments : false
...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

# NuGet packages
/packages/
Debug/
18 changes: 9 additions & 9 deletions Fluid-HTN.UnitTests/Fluid-HTN.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -41,10 +41,10 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -63,23 +63,23 @@
<Compile Include="DomainTests.cs" />
<Compile Include="PlannerTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Fluid-HTN\Fluid-HTN.csproj">
<Project>{B6908CED-5C0B-415C-9564-85F66A8B5025}</Project>
<Name>Fluid-HTN</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
</Project>
4 changes: 2 additions & 2 deletions Fluid-HTN.UnitTests/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" />
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" />
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net472" />
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net472" />
</packages>
48 changes: 48 additions & 0 deletions Fluid-HTN.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,68 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fluid-HTN", "Fluid-HTN\Flui
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fluid-HTN.UnitTests", "Fluid-HTN.UnitTests\Fluid-HTN.UnitTests.csproj", "{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fluid-HTNCPP", "Fluid-HTNCPP\Fluid-HTNCPP.vcxproj", "{0C469B65-6D39-4667-8D00-9EC963C518E3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fluid-HTNCPP.UnitTests", "Fluid-HTNCPP.UnitTests\Fluid-HTNCPP.UnitTests.vcxproj", "{402394C5-2D69-49F0-B2E2-239FAB4CC252}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Debug|x64.ActiveCfg = Debug|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Debug|x64.Build.0 = Debug|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Debug|x86.ActiveCfg = Debug|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Debug|x86.Build.0 = Debug|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Release|Any CPU.Build.0 = Release|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Release|x64.ActiveCfg = Release|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Release|x64.Build.0 = Release|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Release|x86.ActiveCfg = Release|Any CPU
{B6908CED-5C0B-415C-9564-85F66A8B5025}.Release|x86.Build.0 = Release|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Debug|x64.ActiveCfg = Debug|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Debug|x64.Build.0 = Debug|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Debug|x86.ActiveCfg = Debug|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Debug|x86.Build.0 = Debug|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Release|Any CPU.Build.0 = Release|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Release|x64.ActiveCfg = Release|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Release|x64.Build.0 = Release|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Release|x86.ActiveCfg = Release|Any CPU
{A6DAA5DB-FC2B-4D08-87A1-0E667A39CF21}.Release|x86.Build.0 = Release|Any CPU
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Debug|Any CPU.ActiveCfg = Debug|x64
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Debug|Any CPU.Build.0 = Debug|x64
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Debug|x64.ActiveCfg = Debug|x64
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Debug|x64.Build.0 = Debug|x64
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Debug|x86.ActiveCfg = Debug|Win32
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Debug|x86.Build.0 = Debug|Win32
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Release|Any CPU.ActiveCfg = Release|x64
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Release|Any CPU.Build.0 = Release|x64
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Release|x64.ActiveCfg = Release|x64
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Release|x64.Build.0 = Release|x64
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Release|x86.ActiveCfg = Release|Win32
{0C469B65-6D39-4667-8D00-9EC963C518E3}.Release|x86.Build.0 = Release|Win32
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Debug|Any CPU.ActiveCfg = Debug|x64
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Debug|Any CPU.Build.0 = Debug|x64
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Debug|x64.ActiveCfg = Debug|x64
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Debug|x64.Build.0 = Debug|x64
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Debug|x86.ActiveCfg = Debug|Win32
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Debug|x86.Build.0 = Debug|Win32
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Release|Any CPU.ActiveCfg = Release|x64
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Release|Any CPU.Build.0 = Release|x64
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Release|x64.ActiveCfg = Release|x64
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Release|x64.Build.0 = Release|x64
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Release|x86.ActiveCfg = Release|Win32
{402394C5-2D69-49F0-B2E2-239FAB4CC252}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
15 changes: 14 additions & 1 deletion Fluid-HTN/Fluid-HTN.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -13,6 +14,8 @@
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -75,6 +78,16 @@
<Compile Include="Tasks\CompoundTasks\TaskRoot.cs" />
<Compile Include="Tasks\TaskStatus.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
</Project>
4 changes: 4 additions & 0 deletions Fluid-HTN/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net472" />
</packages>
72 changes: 72 additions & 0 deletions Fluid-HTNCPP.UnitTests/ActionEffectsTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#include "pch.h"
#include "CppUnitTest.h"
#include "Contexts/BaseContext.h"
#include "Effects/Effect.h"
#include "DomainTestContext.h"

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

using namespace FluidHTN;

class TestContext : public BaseContext<DomainTestState, uint8_t,DomainTestWorldState>
{
bool _Done = false;
public:
bool& Done() { return _Done; }
};

namespace Microsoft::VisualStudio::CppUnitTestFramework
{
template<>
std::wstring ToString<EffectType>(const EffectType& eff)
{
switch(eff)
{
case EffectType::Permanent:
return L"EffectType::Permanent";
case EffectType::PlanOnly:
return L"EffectType::PlanOnly";
case EffectType::PlanAndExecute:
return L"EffectType::PlanAndExecute";
}
return L"Unknown value";
}
}
namespace FluidHTNCPPUnitTests
{
TEST_CLASS(ActionEffectTests)
{
public:

TEST_METHOD(SetsName_ExpectedBehavior)
{
ActionEffect a("Name", EffectType::PlanOnly, nullptr);

Assert::AreEqual("Name"s, a.Name());
}
TEST_METHOD(SetsType_ExpectedBehavior)
{
ActionEffect e("Name", EffectType::PlanOnly, nullptr);

Assert::AreEqual(EffectType::PlanOnly, e.Type());
}

TEST_METHOD(ApplyDoesNothingWithoutFunctionPtr_ExpectedBehavior)
{
TestContext ctx;
ActionEffect e("Name", EffectType::PlanOnly, nullptr);

e.Apply(ctx);
}

TEST_METHOD(ApplyCallsInternalFunctionPtr_ExpectedBehavior)
{
TestContext ctx;
ActionEffect e("Name", EffectType::PlanOnly, [=](IContext& c, EffectType ) {static_cast<TestContext&>(c).Done() = true; });

e.Apply(ctx);

Assert::AreEqual(true, ctx.Done());
}
};
}
Loading