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,40 +3,40 @@ import DataLiteC
import DataLiteCore
struct ConnectionOptionsTests {
@Test func testReadOnlyOption() {
@Test func readOnlyOption() {
let options: Connection.Options = [.readonly]
#expect(options.contains(.readonly))
}
@Test func testReadWriteOption() {
@Test func readWriteOption() {
let options: Connection.Options = [.readwrite]
#expect(options.contains(.readwrite))
}
@Test func testCreateOption() {
@Test func createOption() {
let options: Connection.Options = [.create]
#expect(options.contains(.create))
}
@Test func testMultipleOptions() {
@Test func multipleOptions() {
let options: Connection.Options = [.readwrite, .create, .memory]
#expect(options.contains(.readwrite))
#expect(options.contains(.create))
#expect(options.contains(.memory))
}
@Test func testNoFollowOption() {
@Test func noFollowOption() {
let options: Connection.Options = [.nofollow]
#expect(options.contains(.nofollow))
}
@Test func testAllOptions() {
@Test func allOptions() {
let options: Connection.Options = [
.readonly, .readwrite, .create, .uri, .memory,
.nomutex, .fullmutex, .sharedcache,
.privatecache, .exrescode, .nofollow
]
#expect(options.contains(.readonly))
#expect(options.contains(.readwrite))
#expect(options.contains(.create))
@@ -50,7 +50,7 @@ struct ConnectionOptionsTests {
#expect(options.contains(.nofollow))
}
@Test func testOptionsRawValue() {
@Test func optionsRawValue() {
let options: Connection.Options = [.readwrite, .create]
let expectedRawValue = Int32(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)
#expect(options.rawValue == expectedRawValue)