@@ -18,14 +18,13 @@ public class GenericTestCases
1818{
1919 private readonly ITestOutputHelper _testOutputHelper ;
2020
21- public GenericTestCases ( ITestOutputHelper testOutputHelper )
21+ public GenericTestCases ( ITestOutputHelper testOutputHelper )
2222 {
2323 _testOutputHelper = testOutputHelper ;
2424 }
25- public static IEnumerable < object [ ] > GetTestCasesJs ( )
26- => TestData . Generic . GetFileNames ( "js" ) . Select ( x => new object [ ] { x } ) ;
27- public static IEnumerable < object [ ] > GetTestCasesRust ( )
28- => TestData . Generic . GetFileNames ( "rust" ) . Select ( x => new object [ ] { x } ) ;
25+
26+ public static IEnumerable < object [ ] > GetTestCases ( )
27+ => TestData . Generic . GetFileNames ( ) . Select ( x => new object [ ] { x } ) ;
2928
3029 [ Fact ]
3130 public Polygon Profile ( )
@@ -43,8 +42,8 @@ public Polygon Profile()
4342 }
4443
4544 [ Theory ]
46- [ MemberData ( nameof ( GetTestCasesRust ) ) ]
47- public void GenericTestCaseRust ( string testCaseFile )
45+ [ MemberData ( nameof ( GetTestCases ) ) ]
46+ public void GenericTestCase ( string testCaseFile )
4847 {
4948 // Arrange
5049 FeatureCollection data = TestData . Generic . GetFeatureCollection ( testCaseFile ) ;
@@ -88,50 +87,6 @@ public void GenericTestCaseRust(string testCaseFile)
8887 }
8988 }
9089
91- [ Theory ( Skip = "JS Tests are not relevant for now. Good when they pass but we focus on the Rust port" ) ]
92- [ MemberData ( nameof ( GetTestCasesJs ) ) ]
93- public void GenericTestCaseJs ( string testCaseFile )
94- {
95- // Arrange
96- FeatureCollection data = TestData . Generic . GetFeatureCollection ( testCaseFile ) ;
97-
98- Assert . True ( data . Features . Count >= 2 , "Test case file must contain at least two features." ) ;
99-
100- IGeometryObject subjectGeometry = data . Features [ 0 ] . Geometry ;
101- IGeometryObject clippingGeometry = data . Features [ 1 ] . Geometry ;
102-
103- Polygon subject = ConvertToPolygon ( subjectGeometry ) ;
104- Polygon clipping = ConvertToPolygon ( clippingGeometry ) ;
105-
106- #pragma warning disable RCS1124 // Inline local variable
107- List < ExpectedResult > expectedResults = ExtractExpectedResults ( data . Features . Skip ( 2 ) . ToList ( ) , data . Type ) ;
108- #pragma warning restore RCS1124 // Inline local variable
109-
110- // ExpectedResult result = expectedResults[1];
111- // Polygon actual = result.Operation(subject, clipping);
112- // Assert.Equal(result.Coordinates.ContourCount, actual.ContourCount);
113-
114- foreach ( ExpectedResult result in expectedResults )
115- {
116- Polygon expected = result . Coordinates ;
117- Polygon actual = result . Operation ( subject , clipping ) ;
118-
119- Assert . Equal ( expected . ContourCount , actual . ContourCount ) ;
120- for ( int i = 0 ; i < expected . ContourCount ; i ++ )
121- {
122- // We don't test for holes here as the reference tests do not do so.
123- Assert . Equal ( expected [ i ] . VertexCount , actual [ i ] . VertexCount ) ;
124- for ( int j = 0 ; j < expected [ i ] . VertexCount ; j ++ )
125- {
126- Vertex expectedVertex = expected [ i ] . GetVertex ( j ) ;
127- Vertex actualVertex = actual [ i ] . GetVertex ( j ) ;
128- Assert . Equal ( expectedVertex . X , actualVertex . X , 3 ) ;
129- Assert . Equal ( expectedVertex . Y , actualVertex . Y , 3 ) ;
130- }
131- }
132- }
133- }
134-
13590 private static Polygon ConvertToPolygon ( IGeometryObject geometry )
13691 {
13792 if ( geometry is GeoPolygon geoJsonPolygon )
0 commit comments