From 2c54ea493025c3b36d52f333a3b5bb0a33b636ab Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Thu, 18 Nov 2010 17:52:22 +0300 Subject: [PATCH] Added a failing test for concurrent use --- test/sqlite3_test.erl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/sqlite3_test.erl b/test/sqlite3_test.erl index 65e28d2..1aca056 100644 --- a/test/sqlite3_test.erl +++ b/test/sqlite3_test.erl @@ -45,7 +45,7 @@ all_test_() -> ?FuncTest(large_number)]}. open_db() -> - sqlite3:open(ct). + sqlite3:open(ct, [in_memory]). close_db({ok, _Pid}) -> sqlite3:close(ct); @@ -145,6 +145,16 @@ select_many_records() -> 1024, length(rows(sqlite3:sql_exec(ct, "select * from many_records;")))). +%% concurrent_inserts_test() -> +%% sqlite3:open(concurrent, [in_memory]), %% doing this test not in memory is much slower! +%% drop_table_if_exists(concurrent, t), +%% sqlite3:create_table(concurrent, t, [{id, integer}]), +%% [spawn(fun () -> sqlite3:write(concurrent, t, [{id, X}]) end) || X <- lists:seq(1, 1024)], +%% ?assertEqual( +%% 1024, +%% length(rows(sqlite3:read_all(concurrent, t)))), +%% sqlite3:close(concurrent). %% doesn't pass at the moment! + nonexistent_table_info() -> ?assertEqual(table_does_not_exist, sqlite3:table_info(ct, nonexistent)).