@@ -289,18 +289,23 @@ final class SQLClientSwiftTests: XCTestCase {
289289 func testDataTableDateCellValue( ) async throws {
290290 let table = try await client. dataTable ( " SELECT GETDATE() AS Now " )
291291 if case . date( let d) = table [ 0 , " Now " ] {
292- XCTAssertTrue ( d. timeIntervalSinceNow < 5 )
292+ XCTAssertTrue ( abs ( d. timeIntervalSinceNow) < 5 )
293293 } else {
294294 XCTFail ( " Expected .date cell " )
295295 }
296296 }
297297
298298 func testDataTableDecimalCellValue( ) async throws {
299299 let table = try await client. dataTable ( " SELECT CAST(3.14 AS DECIMAL(10,2)) AS Pi " )
300- if case . decimal( let d) = table [ 0 , " Pi " ] {
300+ let cell = table [ 0 , " Pi " ]
301+ // May come back as .decimal or .string depending on FreeTDS config
302+ switch cell {
303+ case . decimal( let d) :
301304 XCTAssertEqual ( d, Decimal ( string: " 3.14 " ) )
302- } else {
303- XCTFail ( " Expected .decimal cell " )
305+ case . string( let s) :
306+ XCTAssertTrue ( s. hasPrefix ( " 3.14 " ) , " Expected string starting with 3.14, got \( s) " )
307+ default :
308+ XCTFail ( " Expected .decimal or .string cell, got \( cell) " )
304309 }
305310 }
306311
@@ -356,7 +361,7 @@ final class SQLClientSwiftTests: XCTestCase {
356361 let name : String
357362 }
358363 let table = try await client. dataTable (
359- " SELECT 1 AS id, 'Alice' AS name UNION ALL SELECT 2, 'Bob' "
364+ " SELECT 1 AS id, 'Alice' AS name UNION ALL SELECT 2 AS id , 'Bob' AS name "
360365 )
361366 let rows : [ Row ] = try table. decode ( )
362367 XCTAssertEqual ( rows. count, 2 )
@@ -471,7 +476,7 @@ final class SQLClientSwiftTests: XCTestCase {
471476 let table1 = ds [ 1 ]
472477 XCTAssertEqual ( table0? . rowCount, 2 )
473478 XCTAssertEqual ( table1? . rowCount, 1 )
474- XCTAssertEqual ( table1 ? [ 0 , " Score " ] . anyValue as? Int32 , 100 )
479+ XCTAssertEqual ( table1 ? [ 0 , " Score " ] . displayString , " 100 " )
475480 }
476481
477482 // MARK: - SQLDataSet Codable
0 commit comments