[erlang-questions] how to run PropEr tests from Eunit?

Roman Shestakov romanshestakov@REDACTED
Fri Jun 24 00:12:54 CEST 2011


hello,

I am trying to run PropEr tests from Eunit and I must admit, I can't figure out 
how to run them


lets say I want to test the following three functions

%%--------------------------------------------------------------------
%% @doc
%% convert Date to atom
%% @end
%%--------------------------------------------------------------------
-spec date_to_atom(date()) -> atom().
date_to_atom({Year, Month, Day}) ->
   list_to_atom(date_to_string({Year, Month, Day})).

%%--------------------------------------------------------------------
%% @doc
%% Convert Date to string
%% @end
%%--------------------------------------------------------------------
-spec date_to_string(date()) -> string().
date_to_string({Year, Month, Day}) ->
   lists:flatten(io_lib:format("~4.10.0B~2.10.0B~2.10.0B", [Year, Month, Day])).


%%--------------------------------------------------------------------
%% @doc
%% convert Date represented as atom into Erlang date format
%% @end
%%--------------------------------------------------------------------
-spec atom_to_date(atom()) -> date().
atom_to_date(Date) ->
   Year = list_to_integer(lists:sublist(atom_to_list(Date),1,4)),
   Month = list_to_integer(lists:sublist(atom_to_list(Date),5,2)),
   Day = list_to_integer(lists:sublist(atom_to_list(Date),7,2)),
   {Year, Month, Day}.



with the following property:

proper_time_to_atom() ->
   ?FORALL(Date, date(),
        begin
        EncDate = ec_time_fns:atom_to_date(ec_time_fns:date_to_atom(Date)),
        EncDate =:= Date
        end).
              
running the following from erl works fine
proper:quickcheck(ec_time_fns_tests:proper_time_to_atom()).


but how do I make eunit to run these test?


tried this , but it doesn't seem to work

time_to_atom_test_() ->
   ?_test(proper:quickcheck(proper_time_to_atom())).


any ideas?

Regards, Roman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110623/33d8455d/attachment.htm>


More information about the erlang-questions mailing list