Skip to content

Commit 54690db

Browse files
committed
Reorganize some tests
1 parent f92f6b5 commit 54690db

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

test/runtests.jl

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -117,36 +117,6 @@ r = SQLite.query(db, "SELECT * FROM temp WHERE AlbumId = 0")
117117
@test r[1,3] === Nullable(0)
118118
SQLite.drop!(db, "temp")
119119

120-
binddb = SQLite.DB()
121-
SQLite.query(binddb, "CREATE TABLE temp (n NULL, i6 INT, f REAL, s TEXT, a BLOB)")
122-
SQLite.query(binddb, "INSERT INTO temp VALUES (?1, ?2, ?3, ?4, ?5)"; values=Any[SQLite.NULL, convert(Int64,6), 6.4, "some text", b"bytearray"])
123-
r = SQLite.query(binddb, "SELECT * FROM temp")
124-
@test isa(get(r.columns[1][1], SQLite.NULL), SQLite.NullType)
125-
@test isa(get(r.columns[2][1]), Int)
126-
@test isa(get(r.columns[3][1]), Float64)
127-
@test isa(get(r.columns[4][1]), AbstractString)
128-
@test isa(get(r.columns[5][1]), Vector{UInt8})
129-
SQLite.query(binddb, "CREATE TABLE blobtest (a BLOB, b BLOB)")
130-
SQLite.query(binddb, "INSERT INTO blobtest VALUES (?1, ?2)"; values=Any[b"a", b"b"])
131-
SQLite.query(binddb, "INSERT INTO blobtest VALUES (?1, ?2)"; values=Any[b"a", BigInt(2)])
132-
type Point{T}
133-
x::T
134-
y::T
135-
end
136-
==(a::Point, b::Point) = a.x == b.x && a.y == b.y
137-
p1 = Point(1, 2)
138-
p2 = Point(1.3, 2.4)
139-
SQLite.query(binddb, "INSERT INTO blobtest VALUES (?1, ?2)"; values=Any[b"a", p1])
140-
SQLite.query(binddb, "INSERT INTO blobtest VALUES (?1, ?2)"; values=Any[b"a", p2])
141-
r = SQLite.query(binddb, "SELECT * FROM blobtest";stricttypes=false)
142-
for v in r.columns[1]
143-
@test get(v) == b"a"
144-
end
145-
for (v1, v2) in zip(r.columns[2], Any[b"b", BigInt(2), p1, p2])
146-
@test get(v1) == v2
147-
end
148-
############################################
149-
150120
SQLite.query(db, "CREATE TABLE temp AS SELECT * FROM Album")
151121
r = SQLite.query(db, "SELECT * FROM temp LIMIT :a"; values=Dict(:a => 3))
152122
@test size(r) == (3,3)
@@ -294,7 +264,35 @@ SQLite.execute!(db, "CREATE TABLE IF NOT EXISTS tbl(a INTEGER);")
294264
stmt = SQLite.Stmt(db, "INSERT INTO tbl (a) VALUES (@a);")
295265
SQLite.bind!(stmt, "@a", 1)
296266

297-
rm(dbfile2)
267+
binddb = SQLite.DB()
268+
SQLite.query(binddb, "CREATE TABLE temp (n NULL, i6 INT, f REAL, s TEXT, a BLOB)")
269+
SQLite.query(binddb, "INSERT INTO temp VALUES (?1, ?2, ?3, ?4, ?5)"; values=Any[SQLite.NULL, convert(Int64,6), 6.4, "some text", b"bytearray"])
270+
r = SQLite.query(binddb, "SELECT * FROM temp")
271+
@test isa(get(r.columns[1][1], SQLite.NULL), SQLite.NullType)
272+
@test isa(get(r.columns[2][1]), Int)
273+
@test isa(get(r.columns[3][1]), Float64)
274+
@test isa(get(r.columns[4][1]), AbstractString)
275+
@test isa(get(r.columns[5][1]), Vector{UInt8})
276+
SQLite.query(binddb, "CREATE TABLE blobtest (a BLOB, b BLOB)")
277+
SQLite.query(binddb, "INSERT INTO blobtest VALUES (?1, ?2)"; values=Any[b"a", b"b"])
278+
SQLite.query(binddb, "INSERT INTO blobtest VALUES (?1, ?2)"; values=Any[b"a", BigInt(2)])
279+
type Point{T}
280+
x::T
281+
y::T
282+
end
283+
==(a::Point, b::Point) = a.x == b.x && a.y == b.y
284+
p1 = Point(1, 2)
285+
p2 = Point(1.3, 2.4)
286+
SQLite.query(binddb, "INSERT INTO blobtest VALUES (?1, ?2)"; values=Any[b"a", p1])
287+
SQLite.query(binddb, "INSERT INTO blobtest VALUES (?1, ?2)"; values=Any[b"a", p2])
288+
r = SQLite.query(binddb, "SELECT * FROM blobtest";stricttypes=false)
289+
for v in r.columns[1]
290+
@test get(v) == b"a"
291+
end
292+
for (v1, v2) in zip(r.columns[2], Any[b"b", BigInt(2), p1, p2])
293+
@test get(v1) == v2
294+
end
295+
############################################
298296

299297
installed = Pkg.installed()
300298
haskey(installed, "DataStreamsIntegrationTests") || Pkg.clone("https://github.com/JuliaData/DataStreamsIntegrationTests")

0 commit comments

Comments
 (0)