Skip to content

Commit

Permalink
Added IWktBuilder interface with an impl. WktToProjBuider
Browse files Browse the repository at this point in the history
  • Loading branch information
driekus77 committed Jul 25, 2024
1 parent e425fe7 commit 4fabdf3
Show file tree
Hide file tree
Showing 56 changed files with 1,550 additions and 657 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using NUnit.Framework;
using Pidgin;
using ProjNet.Wkt;
using ProjNet.IO.Wkt.Core;

namespace ProjNET.Tests.WKT;
namespace ProjNet.IO.Wkt.Tests.Core;

public class WktParserTests
{
Expand All @@ -17,7 +17,7 @@ public void TestUnsignedIntegerParser()
uint parserResult01 = WktParser.UnsignedIntegerParser.ParseOrThrow(parserText01);

// Assert
Assert.AreEqual(210677, parserResult01);
Assert.That(parserResult01, Is.EqualTo(210677));
}

[Test]
Expand All @@ -34,9 +34,9 @@ public void TestSignedIntegerParser()
int parserResult03 = WktParser.SignedIntegerParser.ParseOrThrow(parserText03);

// Assert
Assert.AreEqual(210677, parserResult01);
Assert.AreEqual(-210677, parserResult02);
Assert.AreEqual(210677, parserResult03);
Assert.That(parserResult01, Is.EqualTo(210677));
Assert.That(parserResult02, Is.EqualTo(-210677));
Assert.That(parserResult03, Is.EqualTo(210677));
}


Expand All @@ -56,10 +56,10 @@ public void TestSignedNumericLiteralParser()
double parserResult04 = WktParser.SignedNumericLiteralParser.ParseOrThrow(parserText04);

// Assert
Assert.AreEqual(-100.333333333333, parserResult01);
Assert.AreEqual(100.333333333333, parserResult02);
Assert.AreEqual(100.333333333333, parserResult03);
Assert.AreEqual(0.333333333333, parserResult04);
Assert.That(parserResult01, Is.EqualTo(-100.333333333333));
Assert.That(parserResult02, Is.EqualTo(100.333333333333));
Assert.That(parserResult03, Is.EqualTo(100.333333333333));
Assert.That(parserResult04, Is.EqualTo(0.333333333333));
}

[Test]
Expand All @@ -76,9 +76,9 @@ public void TestExactNumericLiteralParser()
double parserResult03 = WktParser.ExactNumericLiteralParser.ParseOrThrow(parserText03);

// Assert
Assert.AreEqual(21.043d, parserResult01);
Assert.AreEqual(0.043d, parserResult02);
Assert.AreEqual(0.043d, parserResult03);
Assert.That(parserResult01, Is.EqualTo(21.043d));
Assert.That(parserResult02, Is.EqualTo(0.043d));
Assert.That(parserResult03, Is.EqualTo(0.043d));
}

[Test]
Expand All @@ -99,11 +99,11 @@ public void TestApproximateNumericLiteralParser()
double parserResult05 = WktParser.ApproximateNumericLiteralParser.ParseOrThrow(parserText05);

// Assert
Assert.AreEqual(0.02104d, parserResult01);
Assert.AreEqual(21040d, parserResult02);
Assert.AreEqual(21040d, parserResult03);
Assert.AreEqual(40d, parserResult04);
Assert.AreEqual(40d, parserResult05);
Assert.That(parserResult01, Is.EqualTo(0.02104d));
Assert.That(parserResult02, Is.EqualTo(21040d));
Assert.That(parserResult03, Is.EqualTo(21040d));
Assert.That(parserResult04, Is.EqualTo(40d));
Assert.That(parserResult05, Is.EqualTo(40d));
}

[Test]
Expand All @@ -117,7 +117,7 @@ public void TestQuotedNameParser()
string parserResult01 = WktParser.QuotedNameParser.ParseOrThrow(parserText01);

// Assert
Assert.AreEqual(str01, parserResult01);
Assert.That(parserResult01, Is.EqualTo(str01));
}


Expand Down
12 changes: 12 additions & 0 deletions ProjNet4GeoAPI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjNET.Tests", "test\ProjN
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjNet.Benchmark", "src\ProjNet.Benchmark\ProjNet.Benchmark.csproj", "{1E5D1CC5-8CFE-4C9D-9553-900469C57D6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjNet.IO.Wkt", "src\ProjNet.IO.Wkt\ProjNet.IO.Wkt.csproj", "{50AAB59B-25FB-4E36-A31A-B22C62B2105E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjNet.IO.Wkt.Tests", "ProjNet.IO.Wkt.Tests\ProjNet.IO.Wkt.Tests.csproj", "{3E23D15C-56F1-4431-B241-FC17D2F54BBF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -33,6 +37,14 @@ Global
{1E5D1CC5-8CFE-4C9D-9553-900469C57D6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E5D1CC5-8CFE-4C9D-9553-900469C57D6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E5D1CC5-8CFE-4C9D-9553-900469C57D6C}.Release|Any CPU.Build.0 = Release|Any CPU
{50AAB59B-25FB-4E36-A31A-B22C62B2105E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50AAB59B-25FB-4E36-A31A-B22C62B2105E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50AAB59B-25FB-4E36-A31A-B22C62B2105E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50AAB59B-25FB-4E36-A31A-B22C62B2105E}.Release|Any CPU.Build.0 = Release|Any CPU
{3E23D15C-56F1-4431-B241-FC17D2F54BBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E23D15C-56F1-4431-B241-FC17D2F54BBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E23D15C-56F1-4431-B241-FC17D2F54BBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E23D15C-56F1-4431-B241-FC17D2F54BBF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 3 additions & 0 deletions src/ProjNet.IO.Wkt/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly:InternalsVisibleTo("ProjNet.IO.Wkt.Tests")]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Globalization;
using System.Text;

namespace ProjNet.Wkt
namespace ProjNet.IO.Wkt.Core
{
/// <summary>
/// DefaultWktOutputFormatter - Keeping output compact with original delimiters.
Expand Down
Loading

0 comments on commit 4fabdf3

Please sign in to comment.