Use eunit for tests and add coverage and surefire reporting to rebar.config

This commit is contained in:
David Reid
2010-10-12 10:36:34 -07:00
parent 8ebf31c83b
commit 766f8483c4
3 changed files with 9 additions and 49 deletions

View File

@@ -1,39 +1,26 @@
%%%-------------------------------------------------------------------
%%% File : sqlite3_test.erl
%%% Author : Tee Teoh <tteoh@teemac.ott.cti.com>
%%% Description :
%%% Description :
%%%
%%% Created : 10 Jun 2008 by Tee Teoh <tteoh@teemac.ott.cti.com>
%%%-------------------------------------------------------------------
-module(sqlite3_test).
%% API
-export([create_table_test/0]).
-include_lib("eunit/include/eunit.hrl").
-record(user, {name, age, wage}).
%%====================================================================
%% API
%%====================================================================
%%--------------------------------------------------------------------
%% Function:
%% Description:
%%--------------------------------------------------------------------
create_table_test() ->
file:delete("ct.db"),
sqlite3:open(ct),
sqlite3:create_table(ct, user, [{name, text}, {age, integer}, {wage, integer}]),
sqlite3:create_table(ct, user, [{name, text}, {age, integer},
{wage, integer}]),
[user] = sqlite3:list_tables(ct),
[{name, primary_key}, {age, integer}, {wage, integer}] = sqlite3:table_info(ct, user),
[{name, primary_key}, {age, integer}, {wage, integer}] =
sqlite3:table_info(ct, user),
sqlite3:write(ct, user, [{name, "abby"}, {age, 20}, {wage, 2000}]),
sqlite3:write(ct, user, [{name, "marge"}, {age, 30}, {wage, 3000}]),
sqlite3:sql_exec(ct, "select * from user;"),
sqlite3:read(ct, user, {name, "abby"}),
sqlite3:delete(ct, user, {name, "abby"}),
sqlite3:drop_table(ct, user),
%sqlite3:delete_db(ct)
sqlite3:close(ct).
% create, read, update, delete
%%====================================================================
%% Internal functions
%%====================================================================