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

@@ -0,0 +1,30 @@
import Testing
@testable import DataLiteCore
struct PragmaTests {
@Test(arguments: [
(Pragma.applicationID, "application_id"),
(Pragma.foreignKeys, "foreign_keys"),
(Pragma.journalMode, "journal_mode"),
(Pragma.synchronous, "synchronous"),
(Pragma.userVersion, "user_version"),
(Pragma.busyTimeout, "busy_timeout")
])
func predefinedPragmas(_ pragma: Pragma, _ expected: String) {
#expect(pragma.rawValue == expected)
#expect(pragma.description == expected)
}
@Test func initRawValue() {
let pragma = Pragma(rawValue: "custom_pragma")
#expect(pragma.rawValue == "custom_pragma")
#expect(pragma.description == "custom_pragma")
}
@Test func initStringLiteral() {
let pragma: Pragma = "another_pragma"
#expect(pragma.rawValue == "another_pragma")
#expect(pragma.description == "another_pragma")
}
}