Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove helper
  • Loading branch information
jberkel committed Oct 23, 2022
commit 0ce78d92aebea37bc68585ae4d0ead17641d86b1
10 changes: 2 additions & 8 deletions Tests/SQLiteTests/Core/BlobTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class BlobTests: XCTestCase {

func test_init_array() {
let blob = Blob(bytes: [42, 42, 42])
XCTAssertEqual(blob.byteArray, [42, 42, 42])
XCTAssertEqual([UInt8](blob.data), [42, 42, 42])
}

func test_init_unsafeRawPointer() {
let pointer = UnsafeMutablePointer<UInt8>.allocate(capacity: 3)
pointer.initialize(repeating: 42, count: 3)
let blob = Blob(bytes: pointer, length: 3)
XCTAssertEqual(blob.byteArray, [42, 42, 42])
XCTAssertEqual([UInt8](blob.data), [42, 42, 42])
}

func test_equality() {
Expand All @@ -35,9 +35,3 @@ class BlobTests: XCTestCase {
XCTAssertNotEqual(blob1, blob3)
}
}

extension Blob {
var byteArray: [UInt8] {
[UInt8](data)
}
}
3 changes: 1 addition & 2 deletions Tests/SQLiteTests/Core/StatementTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class StatementTests: SQLiteTestCase {
try db.run(blobs.create { $0.column(blobColumn) })
try db.run(blobs.insert(blobColumn <- Blob(bytes: [])))
let blobValue = try db.scalar(blobs.select(blobColumn).limit(1, offset: 0))
XCTAssertEqual([], blobValue.byteArray)
XCTAssertEqual([], [UInt8](blobValue.data))
}

func test_prepareRowIterator() throws {
Expand Down Expand Up @@ -71,5 +71,4 @@ class StatementTests: SQLiteTestCase {
// truncate succeeds
try db.run("DROP TABLE users")
}

}
2 changes: 1 addition & 1 deletion Tests/SQLiteTests/FoundationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class FoundationTests: XCTestCase {
func testDataFromBlob() {
let data = Data([1, 2, 3])
let blob = data.datatypeValue
XCTAssertEqual([1, 2, 3], blob.byteArray)
XCTAssertEqual([1, 2, 3], [UInt8](blob.data))
}

func testBlobToData() {
Expand Down