1414
1515@testable import App
1616
17+ import Testing
18+
1719@preconcurrency import Parsing
18- import XCTest
1920
2021
21- class QueryPlanTests : XCTestCase {
22- func test_cost_parse ( ) throws {
23- XCTAssertEqual (
24- try QueryPlan . cost . parse ( " cost=1.05..12.06 rows=1 width=205 " ) ,
25- . init( firstRow: 1.05 , total: 12.06 )
22+ @ Suite struct QueryPlanTests {
23+
24+ @ Test func cost_parse ( ) throws {
25+ #expect (
26+ try QueryPlan . cost . parse ( " cost=1.05..12.06 rows=1 width=205 " ) == . init( firstRow: 1.05 , total: 12.06 )
2627 )
2728 }
2829
29- func test_actualTime_parse( ) throws {
30- XCTAssertEqual (
31- try QueryPlan . actualTime. parse ( " actual time=8.340..44.485 rows=121 loops=1 " ) ,
32- . init( firstRow: 8.34 , total: 44.485 )
30+ @Test func actualTime_parse( ) throws {
31+ #expect(
32+ try QueryPlan . actualTime. parse ( " actual time=8.340..44.485 rows=121 loops=1 " ) == . init( firstRow: 8.34 , total: 44.485 )
3333 )
3434 }
3535
36- func test_parser( ) throws {
37- XCTAssertEqual (
38- try QueryPlan . parser. parse ( " Append (cost=412.37..3826.71 rows=81 width=308) (actual time=8.340..44.485 rows=121 loops=1) " ) ,
39- . init( cost: . init( firstRow: 412.37 , total: 3826.71 ) ,
36+ @Test func parser( ) throws {
37+ #expect(
38+ try QueryPlan . parser. parse ( " Append (cost=412.37..3826.71 rows=81 width=308) (actual time=8.340..44.485 rows=121 loops=1) " ) == . init( cost: . init( firstRow: 412.37 , total: 3826.71 ) ,
4039 actualTime: . init( firstRow: 8.34 , total: 44.485 ) )
4140 )
4241 }
4342
44- func test_init ( ) throws {
43+ @ Test func QueryPlan_init ( ) throws {
4544 let input = #"""
4645 Sort (cost=555.79..566.89 rows=4439 width=318) (actual time=53.590..53.927 rows=4330 loops=1)
4746 Sort Key: ((lower(package_name) = 'a'::text)) DESC, score DESC, package_name
@@ -52,10 +51,10 @@ class QueryPlanTests: XCTestCase {
5251 Planning Time: 0.853 ms
5352 Execution Time: 55.151 ms
5453 """#
55- XCTAssertEqual ( try QueryPlan ( input) ,
56- . init( cost: . init( firstRow: 555.79 , total: 566.89 ) ,
54+ #expect( try QueryPlan ( input) == . init( cost: . init( firstRow: 555.79 , total: 566.89 ) ,
5755 actualTime: . init( firstRow: 53.590 , total: 53.927 ) ) )
5856 }
57+
5958}
6059
6160
0 commit comments