55// Created by Adrian Schönig on 9/12/2022.
66//
77
8- import XCTest
8+ #if canImport(Testing)
9+ import Testing
910
1011@testable import GeoProjector
1112
12- final class TranslationTests : XCTestCase {
13- func testEquirectangularInSquare ( ) throws {
14- XCTAssertEqual ( Projections . Equirectangular ( ) . translate ( Point ( x: 0 , y: 0 ) , to: . init( width: 100 , height: 100 ) , coordinateSystem: . topLeft) , . init( x: 50 , y: 50 ) )
13+ struct TranslationTests {
14+ @ Test func equirectangularInSquare ( ) throws {
15+ #expect ( Projections . Equirectangular ( ) . translate ( Point ( x: 0 , y: 0 ) , to: . init( width: 100 , height: 100 ) , coordinateSystem: . topLeft) == . init( x: 50 , y: 50 ) )
1516
16- XCTAssertEqual ( Projections . Equirectangular ( ) . translate ( Point ( x: - 1 * . pi, y: 0.5 * . pi) , to: . init( width: 100 , height: 100 ) , coordinateSystem: . topLeft) , . init( x: 0 , y: 25 ) )
17+ #expect ( Projections . Equirectangular ( ) . translate ( Point ( x: - 1 * . pi, y: 0.5 * . pi) , to: . init( width: 100 , height: 100 ) , coordinateSystem: . topLeft) == . init( x: 0 , y: 25 ) )
1718
18- XCTAssertEqual ( Projections . Equirectangular ( ) . translate ( Point ( x: . pi, y: 0.5 * . pi) , to: . init( width: 100 , height: 100 ) , coordinateSystem: . topLeft) , . init( x: 100 , y: 25 ) )
19+ #expect ( Projections . Equirectangular ( ) . translate ( Point ( x: . pi, y: 0.5 * . pi) , to: . init( width: 100 , height: 100 ) , coordinateSystem: . topLeft) == . init( x: 100 , y: 25 ) )
1920
20- XCTAssertEqual ( Projections . Equirectangular ( ) . translate ( Point ( x: . pi, y: - 0.5 * . pi) , to: . init( width: 100 , height: 100 ) , coordinateSystem: . topLeft) , . init( x: 100 , y: 75 ) )
21+ #expect ( Projections . Equirectangular ( ) . translate ( Point ( x: . pi, y: - 0.5 * . pi) , to: . init( width: 100 , height: 100 ) , coordinateSystem: . topLeft) == . init( x: 100 , y: 75 ) )
2122
22- XCTAssertEqual ( Projections . Equirectangular ( ) . translate ( Point ( x: - 1 * . pi, y: - 0.5 * . pi) , to: . init( width: 100 , height: 100 ) , coordinateSystem: . topLeft) , . init( x: 0 , y: 75 ) )
23+ #expect ( Projections . Equirectangular ( ) . translate ( Point ( x: - 1 * . pi, y: - 0.5 * . pi) , to: . init( width: 100 , height: 100 ) , coordinateSystem: . topLeft) == . init( x: 0 , y: 75 ) )
2324 }
2425
25- func testEquirectangularInWideStripe ( ) throws {
26- XCTAssertEqual ( Projections . Equirectangular ( ) . translate ( Point ( x: 0 , y: 0 ) , to: . init( width: 400 , height: 100 ) , coordinateSystem: . topLeft) , . init( x: 200 , y: 50 ) )
26+ @ Test func equirectangularInWideStripe ( ) throws {
27+ #expect ( Projections . Equirectangular ( ) . translate ( Point ( x: 0 , y: 0 ) , to: . init( width: 400 , height: 100 ) , coordinateSystem: . topLeft) == . init( x: 200 , y: 50 ) )
2728
28- XCTAssertEqual ( Projections . Equirectangular ( ) . translate ( Point ( x: - 1 * . pi, y: 0.5 * . pi) , to: . init( width: 400 , height: 100 ) , coordinateSystem: . topLeft) , . init( x: 100 , y: 0 ) )
29+ #expect ( Projections . Equirectangular ( ) . translate ( Point ( x: - 1 * . pi, y: 0.5 * . pi) , to: . init( width: 400 , height: 100 ) , coordinateSystem: . topLeft) == . init( x: 100 , y: 0 ) )
2930
30- XCTAssertEqual ( Projections . Equirectangular ( ) . translate ( Point ( x: . pi, y: 0.5 * . pi) , to: . init( width: 400 , height: 100 ) , coordinateSystem: . topLeft) , . init( x: 300 , y: 0 ) )
31+ #expect ( Projections . Equirectangular ( ) . translate ( Point ( x: . pi, y: 0.5 * . pi) , to: . init( width: 400 , height: 100 ) , coordinateSystem: . topLeft) == . init( x: 300 , y: 0 ) )
3132
32- XCTAssertEqual ( Projections . Equirectangular ( ) . translate ( Point ( x: . pi, y: - 0.5 * . pi) , to: . init( width: 400 , height: 100 ) , coordinateSystem: . topLeft) , . init( x: 300 , y: 100 ) )
33+ #expect ( Projections . Equirectangular ( ) . translate ( Point ( x: . pi, y: - 0.5 * . pi) , to: . init( width: 400 , height: 100 ) , coordinateSystem: . topLeft) == . init( x: 300 , y: 100 ) )
3334
34- XCTAssertEqual ( Projections . Equirectangular ( ) . translate ( Point ( x: - 1 * . pi, y: - 0.5 * . pi) , to: . init( width: 400 , height: 100 ) , coordinateSystem: . topLeft) , . init( x: 100 , y: 100 ) )
35+ #expect ( Projections . Equirectangular ( ) . translate ( Point ( x: - 1 * . pi, y: - 0.5 * . pi) , to: . init( width: 400 , height: 100 ) , coordinateSystem: . topLeft) == . init( x: 100 , y: 100 ) )
3536 }
3637}
38+
39+ #endif
0 commit comments