Skip to content

Commit 1259ab4

Browse files
Simplify test (use of SUM is not necessary to get a numeric value)
1 parent f60cb33 commit 1259ab4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Tests/PostgreSQLTests/PostgreSQLConnectionTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,8 @@ class PostgreSQLConnectionTests: XCTestCase {
563563
func testNumericDecode() throws {
564564
let conn = try PostgreSQLConnection.makeTest()
565565

566-
let sum = { (value: String) -> PostgreSQLSelectExpression in
567-
.expression(.function(.function("SUM", [.expression(.literal(.numeric(value)))])), alias: .identifier("value"))
566+
let expression = { (value: String) -> PostgreSQLSelectExpression in
567+
.expression(.literal(.numeric(value)), alias: .identifier("value"))
568568
}
569569

570570
var testValues = ["0.543201203", "1000.1", "10000.1", "42.0001", "42.00001", "10234.543201", "102340567.8"]
@@ -575,7 +575,7 @@ class PostgreSQLConnectionTests: XCTestCase {
575575
}
576576

577577
for value in testValues {
578-
let result = try conn.select().column(sum(value)).first(decoding: NumericString.self).wait()?.value
578+
let result = try conn.select().column(expression(value)).first(decoding: NumericString.self).wait()?.value
579579
XCTAssert(result == value)
580580
}
581581

@@ -584,7 +584,7 @@ class PostgreSQLConnectionTests: XCTestCase {
584584
}
585585

586586
for value in testValues {
587-
let result = try conn.select().column(sum(value)).first(decoding: NumericDouble.self).wait()?.value
587+
let result = try conn.select().column(expression(value)).first(decoding: NumericDouble.self).wait()?.value
588588
XCTAssert(result == Double(value))
589589
}
590590
}

0 commit comments

Comments
 (0)