Skip to content

Commit

Permalink
Fix unit tests, move code to v1
Browse files Browse the repository at this point in the history
  • Loading branch information
roy-t committed Jan 15, 2020
1 parent ec0ea45 commit 75c1887
Show file tree
Hide file tree
Showing 46 changed files with 51 additions and 41 deletions.
58 changes: 33 additions & 25 deletions Roy-T.AStar.sln
Original file line number Diff line number Diff line change
@@ -1,49 +1,57 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roy-T.AStar", "Roy-T.AStar\Roy-T.AStar.csproj", "{B9C572AD-526E-48C0-9B64-582CD83515EB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Viewer", "Viewer\Viewer.csproj", "{36D92D36-8B53-4E32-8D63-2E89B6E85430}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark", "Benchmark\Benchmark.csproj", "{6C823AA9-1821-4F6D-AC19-3BCD3E2488A2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7484E05D-3E03-498B-AA98-A49AE2D9D488}"
ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
README.md = README.md
versions.md = versions.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{AF080E20-16DB-4105-BE12-07DFD541990E}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "v1", "v1", "{CE7CBD74-507A-45D1-BF02-CF1B433A7D0D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark", "v1\Benchmark\Benchmark.csproj", "{E77139A2-E448-43B6-959F-C6543AD32E9A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roy-T.AStar", "v1\Roy-T.AStar\Roy-T.AStar.csproj", "{8F3A4DD0-2B68-4FE2-B14F-096B08C56483}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "v1\UnitTests\UnitTests.csproj", "{8A26B338-121D-4AA3-AACF-8E3F4686F406}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Viewer", "v1\Viewer\Viewer.csproj", "{A30DC8F8-7278-4A2D-BDCF-3215CCE85E30}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B9C572AD-526E-48C0-9B64-582CD83515EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9C572AD-526E-48C0-9B64-582CD83515EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9C572AD-526E-48C0-9B64-582CD83515EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9C572AD-526E-48C0-9B64-582CD83515EB}.Release|Any CPU.Build.0 = Release|Any CPU
{36D92D36-8B53-4E32-8D63-2E89B6E85430}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{36D92D36-8B53-4E32-8D63-2E89B6E85430}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36D92D36-8B53-4E32-8D63-2E89B6E85430}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36D92D36-8B53-4E32-8D63-2E89B6E85430}.Release|Any CPU.Build.0 = Release|Any CPU
{6C823AA9-1821-4F6D-AC19-3BCD3E2488A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C823AA9-1821-4F6D-AC19-3BCD3E2488A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C823AA9-1821-4F6D-AC19-3BCD3E2488A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C823AA9-1821-4F6D-AC19-3BCD3E2488A2}.Release|Any CPU.Build.0 = Release|Any CPU
{AF080E20-16DB-4105-BE12-07DFD541990E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF080E20-16DB-4105-BE12-07DFD541990E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF080E20-16DB-4105-BE12-07DFD541990E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF080E20-16DB-4105-BE12-07DFD541990E}.Release|Any CPU.Build.0 = Release|Any CPU
{E77139A2-E448-43B6-959F-C6543AD32E9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E77139A2-E448-43B6-959F-C6543AD32E9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E77139A2-E448-43B6-959F-C6543AD32E9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E77139A2-E448-43B6-959F-C6543AD32E9A}.Release|Any CPU.Build.0 = Release|Any CPU
{8F3A4DD0-2B68-4FE2-B14F-096B08C56483}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F3A4DD0-2B68-4FE2-B14F-096B08C56483}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F3A4DD0-2B68-4FE2-B14F-096B08C56483}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F3A4DD0-2B68-4FE2-B14F-096B08C56483}.Release|Any CPU.Build.0 = Release|Any CPU
{8A26B338-121D-4AA3-AACF-8E3F4686F406}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A26B338-121D-4AA3-AACF-8E3F4686F406}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A26B338-121D-4AA3-AACF-8E3F4686F406}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A26B338-121D-4AA3-AACF-8E3F4686F406}.Release|Any CPU.Build.0 = Release|Any CPU
{A30DC8F8-7278-4A2D-BDCF-3215CCE85E30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A30DC8F8-7278-4A2D-BDCF-3215CCE85E30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A30DC8F8-7278-4A2D-BDCF-3215CCE85E30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A30DC8F8-7278-4A2D-BDCF-3215CCE85E30}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E77139A2-E448-43B6-959F-C6543AD32E9A} = {CE7CBD74-507A-45D1-BF02-CF1B433A7D0D}
{8F3A4DD0-2B68-4FE2-B14F-096B08C56483} = {CE7CBD74-507A-45D1-BF02-CF1B433A7D0D}
{8A26B338-121D-4AA3-AACF-8E3F4686F406} = {CE7CBD74-507A-45D1-BF02-CF1B433A7D0D}
{A30DC8F8-7278-4A2D-BDCF-3215CCE85E30} = {CE7CBD74-507A-45D1-BF02-CF1B433A7D0D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0444D9DA-E5C8-4826-BE0F-4EB151D23592}
EndGlobalSection
Expand Down
File renamed without changes.
12 changes: 7 additions & 5 deletions Benchmark/Program.cs → v1/Benchmark/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public AStarBenchmark()
// heuristic is often wrong. This way we test
// the efficiency of our implementation
// not the efficiency of the A* algorithm
this.GridWithSlope = new Grid(100, 100, 1.0f);
this.GridWithSlope = new Grid(100, 100, 1.0f);

var cost = 1.0f;
for (var y = 0; y < this.GridWithSlope.DimY; y++)
Expand All @@ -26,15 +26,16 @@ public AStarBenchmark()
cost += 0.5f;
}
}
}
}

[Benchmark]
public void Gradient100X100()
{
this.GridWithSlope.GetPath(
new Position(0, 0),
new Position(this.GridWithSlope.DimX - 1, this.GridWithSlope.DimY - 1),
MovementPatterns.Full);
MovementPatterns.Full,
AgentShapes.Dot);
}

[Benchmark]
Expand All @@ -44,15 +45,16 @@ public void Gradient100X100Limited()
new Position(0, 0),
new Position(this.GridWithSlope.DimX - 1, this.GridWithSlope.DimY - 1),
MovementPatterns.Full,
AgentShapes.Dot,
int.MaxValue);
}
}

public class Program
{
public static void Main(string[] args)
{
BenchmarkRunner.Run<AStarBenchmark>();
{
BenchmarkRunner.Run<AStarBenchmark>();
Console.ReadLine();
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Xunit;

namespace UnitTests
{
{
public class PathFinderTests
{
[Fact]
Expand Down Expand Up @@ -61,17 +61,17 @@ public void ShouldRespectCellCost()
public void ShouldRespectIterationLimit()
{
var grid = GridCatalog.UnobstructedGrid();
var path = grid.GetPath(new Position(0, 0), new Position(8, 8), MovementPatterns.Full, 8);
var path = grid.GetPath(new Position(0, 0), new Position(8, 8), MovementPatterns.Full, AgentShapes.Dot, 8);

Assert.NotNull(path);
Assert.Empty(path);
Assert.Empty(path);
}

[Fact]
public void ShouldRespectMovementPattern()
{
var grid = GridCatalog.GridWithObstructedDiagonals();
var path = grid.GetPath(new Position(0, 0), new Position(8, 8), MovementPatterns.LateralOnly);
var path = grid.GetPath(new Position(0, 0), new Position(8, 8), MovementPatterns.LateralOnly, AgentShapes.Dot);

Assert.NotNull(path);
Assert.Empty(path);
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions UnitTests/UnitTests.csproj → v1/UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AF080E20-16DB-4105-BE12-07DFD541990E}</ProjectGuid>
<ProjectGuid>{8A26B338-121D-4AA3-AACF-8E3F4686F406}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTests</RootNamespace>
Expand Down Expand Up @@ -68,15 +68,15 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\xunit.analyzers.0.7.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Roy-T.AStar\Roy-T.AStar.csproj">
<Project>{b9c572ad-526e-48c0-9b64-582cd83515eb}</Project>
<Project>{8f3a4dd0-2b68-4fe2-b14f-096b08c56483}</Project>
<Name>Roy-T.AStar</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\xunit.analyzers.0.7.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
</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">
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions Viewer/Viewer.csproj → v1/Viewer/Viewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{36D92D36-8B53-4E32-8D63-2E89B6E85430}</ProjectGuid>
<ProjectGuid>{A30DC8F8-7278-4A2D-BDCF-3215CCE85E30}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Viewer</RootNamespace>
<AssemblyName>Viewer</AssemblyName>
Expand Down Expand Up @@ -154,7 +154,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Roy-T.AStar\Roy-T.AStar.csproj">
<Project>{b9c572ad-526e-48c0-9b64-582cd83515eb}</Project>
<Project>{8f3a4dd0-2b68-4fe2-b14f-096b08c56483}</Project>
<Name>Roy-T.AStar</Name>
</ProjectReference>
</ItemGroup>
Expand Down
File renamed without changes.

0 comments on commit 75c1887

Please sign in to comment.