Skip to content
This repository was archived by the owner on Dec 17, 2018. It is now read-only.

Commit 1f0cdf6

Browse files
committed
Fix tests and benchmark
1 parent 2d830a4 commit 1f0cdf6

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

bench/big_data_test.exs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
defmodule BigDataTest do
22
use ExUnit.Case
33
@timeout :infinity
4+
alias Sqlite.Connection
45

56
@tag :bench
67
@tag timeout: @timeout
78
test "BIG DATA" do
8-
{:ok, conn} = Sqlite.open(database: ":memory:")
9+
{:ok, conn} = Connection.open(database: ":memory:")
910

1011
column_names_and_types =
1112
"a int, b int, c int, d int, e int, f int, g int, h int, i int, j int, " <>
@@ -17,20 +18,20 @@ defmodule BigDataTest do
1718
subs =
1819
"$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26"
1920

20-
{:ok, q} = Sqlite.prepare(conn, "CREATE TABLE posts (#{column_names_and_types})")
21-
{:ok, _} = Sqlite.execute(conn, q, [])
21+
{:ok, q} = Connection.prepare(conn, "CREATE TABLE posts (#{column_names_and_types})")
22+
{:ok, _} = Connection.execute(conn, q, [])
2223

2324
{:ok, statement} =
24-
Sqlite.prepare(conn, "INSERT INTO posts (#{column_names}) VALUES (#{subs})")
25+
Connection.prepare(conn, "INSERT INTO posts (#{column_names}) VALUES (#{subs})")
2526

26-
{:ok, _} = Sqlite.execute(conn, statement, Enum.to_list(1..26))
27+
{:ok, _} = Connection.execute(conn, statement, Enum.to_list(1..26))
2728
range = 0..800_000
2829

2930
inserts_fun = fn ->
3031
{time, _} =
3132
:timer.tc(fn ->
3233
for _i <- range do
33-
{:ok, _} = Sqlite.execute(conn, statement, Enum.to_list(1..26))
34+
{:ok, _} = Connection.execute(conn, statement, Enum.to_list(1..26))
3435
end
3536
end)
3637

@@ -40,7 +41,7 @@ defmodule BigDataTest do
4041
query_fun = fn ->
4142
{time, res} =
4243
:timer.tc(fn ->
43-
Sqlite.query!(conn, "SELECT * FROM posts;", [], timeout: @timeout)
44+
Connection.query!(conn, "SELECT * FROM posts;", [], timeout: @timeout)
4445
end)
4546

4647
IO.puts("Query took: #{time} µs.")

test/sqlite/connection_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ defmodule Sqlite.Connection.Test do
9797
test "inspect prepared query.", %{conn: conn} do
9898
query = Connection.prepare!(conn, "CREATE TABLE loop (id)")
9999
assert inspect(query) =~ "#Statement<"
100-
empty = %Sqlite.Query{}
100+
empty = %Query{}
101101
catch_exit(inspect(empty))
102102
end
103103

0 commit comments

Comments
 (0)