diff options
Diffstat (limited to 'Tests/WmapParserTests/ComponentParserTests.swift')
| -rw-r--r-- | Tests/WmapParserTests/ComponentParserTests.swift | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/Tests/WmapParserTests/ComponentParserTests.swift b/Tests/WmapParserTests/ComponentParserTests.swift index 52e347a..1f3a451 100644 --- a/Tests/WmapParserTests/ComponentParserTests.swift +++ b/Tests/WmapParserTests/ComponentParserTests.swift @@ -4,128 +4,128 @@ import Testing @Test func shouldParseABasicComponent() { let source = "Dominoes (0.9, 0.5)" - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "Dominoes", coordinates: MapPoint(xCoordinate: 0.9, yCoordinate: 0.5), shape: .circle + == WmapParser.Component( + label: "Dominoes", coordinates: WmapParser.MapPoint(xCoordinate: 0.9, yCoordinate: 0.5), shape: .circle ) ) } @Test func shouldParseAComponentWithAShape() { let source = "Database (0.33, 0.81) [Square]" - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "Database", coordinates: MapPoint(xCoordinate: 0.33, yCoordinate: 0.81), + == WmapParser.Component( + label: "Database", coordinates: WmapParser.MapPoint(xCoordinate: 0.33, yCoordinate: 0.81), shape: .square) ) } @Test func shouldParseAComponentWithXShape() { let source = "API (0.5, 0.6) [x]" - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "API", coordinates: MapPoint(xCoordinate: 0.5, yCoordinate: 0.6), shape: .xMark) + == WmapParser.Component( + label: "API", coordinates: WmapParser.MapPoint(xCoordinate: 0.5, yCoordinate: 0.6), shape: .xMark) ) } @Test func shouldParseAComponentWithTriangleShape() { let source = "Service (0.4, 0.7) [Triangle]" - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "Service", coordinates: MapPoint(xCoordinate: 0.4, yCoordinate: 0.7), + == WmapParser.Component( + label: "Service", coordinates: WmapParser.MapPoint(xCoordinate: 0.4, yCoordinate: 0.7), shape: .triangle) ) } @Test func shouldParseAComponentWithCircleShape() { let source = "Process (0.2, 0.9) [CIRCLE]" - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "Process", coordinates: MapPoint(xCoordinate: 0.2, yCoordinate: 0.9), shape: .circle) + == WmapParser.Component( + label: "Process", coordinates: WmapParser.MapPoint(xCoordinate: 0.2, yCoordinate: 0.9), shape: .circle) ) } @Test func shouldDefaultShapeToCircleIfInvalid() { let source = "Figures (0.12, 0.711) [" - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "Figures", coordinates: MapPoint(xCoordinate: 0.12, yCoordinate: 0.711), + == WmapParser.Component( + label: "Figures", coordinates: WmapParser.MapPoint(xCoordinate: 0.12, yCoordinate: 0.711), shape: .circle) ) } @Test func shouldHandleDecimalNumbers() { let source = "Item (.5, .123)" - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "Item", coordinates: MapPoint(xCoordinate: 0.5, yCoordinate: 0.123), shape: .circle) + == WmapParser.Component( + label: "Item", coordinates: WmapParser.MapPoint(xCoordinate: 0.5, yCoordinate: 0.123), shape: .circle) ) } @Test func shouldHandleIntegersAsCoordinates() { let source = "Item (1, 0)" - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "Item", coordinates: MapPoint(xCoordinate: 1.0, yCoordinate: 0.0), shape: .circle) + == WmapParser.Component( + label: "Item", coordinates: WmapParser.MapPoint(xCoordinate: 1.0, yCoordinate: 0.0), shape: .circle) ) } @Test func shouldPreserveCaseInComponentLabels() { let source = "RubberGaskets (0.5, 0.5)" - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "RubberGaskets", coordinates: MapPoint(xCoordinate: 0.5, yCoordinate: 0.5), + == WmapParser.Component( + label: "RubberGaskets", coordinates: WmapParser.MapPoint(xCoordinate: 0.5, yCoordinate: 0.5), shape: .circle) ) } @Test func shouldHandleComponentLabelsWithSpaces() { let source = "Big Lawnmowers (0.5, 0.5)" - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "Big Lawnmowers", coordinates: MapPoint(xCoordinate: 0.5, yCoordinate: 0.5), + == WmapParser.Component( + label: "Big Lawnmowers", coordinates: WmapParser.MapPoint(xCoordinate: 0.5, yCoordinate: 0.5), shape: .circle) ) } @Test func shouldHandleWhitespaceAroundTokens() { let source = " Outer Space ( 0.9 , 0.5 ) [ Square ] " - let result = parse(source) + let result = WmapParser.parse(source) #expect(result.components.count == 1) #expect( result.components.first - == Component( - label: "Outer Space", coordinates: MapPoint(xCoordinate: 0.9, yCoordinate: 0.5), + == WmapParser.Component( + label: "Outer Space", coordinates: WmapParser.MapPoint(xCoordinate: 0.9, yCoordinate: 0.5), shape: .square) ) } |