Permalink
Browse files

Add some tests

  • Loading branch information...
1 parent 3511c53 commit c2064edfb0219dd6f134da4c78d1c16d6dc59bba @msantos committed Mar 14, 2012
Showing with 49 additions and 0 deletions.
  1. +2 −0 Makefile
  2. +47 −0 test/crypt_tests.erl
View
@@ -15,3 +15,5 @@ compile: $(REBAR)
clean: $(REBAR)
@$(REBAR) clean
+test: $(REBAR) compile
+ @$(REBAR) eunit
View
@@ -0,0 +1,47 @@
+%% Copyright (c) 2012, Michael Santos <michael.santos@gmail.com>
+%% All rights reserved.
+%%
+%% Redistribution and use in source and binary forms, with or without
+%% modification, are permitted provided that the following conditions
+%% are met:
+%%
+%% Redistributions of source code must retain the above copyright
+%% notice, this list of conditions and the following disclaimer.
+%%
+%% Redistributions in binary form must reproduce the above copyright
+%% notice, this list of conditions and the following disclaimer in the
+%% documentation and/or other materials provided with the distribution.
+%%
+%% Neither the name of the author nor the names of its contributors
+%% may be used to endorse or promote products derived from this software
+%% without specific prior written permission.
+%%
+%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+%% "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+%% LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+%% FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+%% COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+%% INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+%% BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+%% LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+%% CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+%% LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+%% ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+%% POSSIBILITY OF SUCH DAMAGE.
+-module(crypt_tests).
+
+-compile(export_all).
+
+-include_lib("eunit/include/eunit.hrl").
+
+
+crypt_test() ->
+ "aaqPiZY5xR5l." = crypt:crypt("test","aa"),
+
+ case os:type() of
+ {unix, linux} ->
+ "$1$aaaaaaaa$lWxWtPmiNjS/cwJnGm6fe0" = crypt:crypt("test","$1$aaaaaaaa"),
+ "$6$aaaaaaaa$HREHv6TuSmUS/7spCDO5Js3ssSZ6.iwVkUoVtatJUhJDKVmERrRKBT"
+ "olrPMub2s5dX6IEjZg6d6wZzFRlidV41" = crypt:crypt("test","$6$aaaaaaaa");
+ _ -> ok
+ end.

0 comments on commit c2064ed

Please sign in to comment.