Add unit tests

This commit is contained in:
2025-10-25 18:56:55 +03:00
parent ddc47abdde
commit bbb7f14650
38 changed files with 1051 additions and 526 deletions

View File

@@ -3,18 +3,19 @@ import Foundation
import DataLiteCore
struct UUIDTests {
@Test func testUUIDToSQLiteRawValue() {
@Test func uuidToSQLiteValue() {
let uuid = UUID(uuidString: "123e4567-e89b-12d3-a456-426614174000")!
#expect(uuid.sqliteValue == .text("123E4567-E89B-12D3-A456-426614174000"))
}
@Test func testSQLiteRawValueToUUID() {
@Test func uuidFromSQLiteValue() {
let raw = SQLiteValue.text("123e4567-e89b-12d3-a456-426614174000")
#expect(UUID(raw) == UUID(uuidString: "123e4567-e89b-12d3-a456-426614174000"))
#expect(UUID(.text("invalid-uuid-string")) == nil)
#expect(UUID(.int(42)) == nil)
#expect(UUID(.blob(Data([0x01, 0x02]))) == nil)
#expect(UUID(.null) == nil)
#expect(UUID(SQLiteValue.int(42)) == nil)
#expect(UUID(SQLiteValue.real(42)) == nil)
#expect(UUID(SQLiteValue.text("42")) == nil)
#expect(UUID(SQLiteValue.blob(Data([0x42]))) == nil)
#expect(UUID(SQLiteValue.null) == nil)
}
}