diff --git a/test/sqlite3_test.erl b/test/sqlite3_test.erl index 8541e4a..289fb64 100644 --- a/test/sqlite3_test.erl +++ b/test/sqlite3_test.erl @@ -165,21 +165,21 @@ select_many_records() -> N, length(rows(sqlite3:sql_exec(ct, "select * from many_records;")))). -%% %% note that inserts are actually serialized by gen_server -%% concurrent_inserts_test() -> -%% N = 1024, -%% 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, [{id0, integer}]), -%% Self = self(), -%% [spawn(fun () -> -%% sqlite3:write(concurrent, t, [{id0, X}]), -%% Self ! {finished, N} -%% end) || X <- lists:seq(1, N)], -%% loop_concurrent_inserts(N), -%% ?assertEqual( -%% N, length(rows(sqlite3:read_all(concurrent, t)))), -%% sqlite3:close(concurrent). +%% note that inserts are actually serialized by gen_server +concurrent_inserts_test() -> + N = 1024, + 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, [{id0, integer}]), + Self = self(), + [spawn(fun () -> + sqlite3:write(concurrent, t, [{id0, X}]), + Self ! {finished, N} + end) || X <- lists:seq(1, N)], + loop_concurrent_inserts(N), + ?assertEqual( + N, length(rows(sqlite3:read_all(concurrent, t)))), + sqlite3:close(concurrent). loop_concurrent_inserts(0) -> ok;