Add a simple test in geef_oid
This commit is contained in:
3
Makefile
3
Makefile
@@ -13,3 +13,6 @@ compile: $(REBAR)
|
||||
|
||||
clean: $(REBAR)
|
||||
@$(REBAR) clean
|
||||
|
||||
test: $(REBAR)
|
||||
@$(REBAR) eunit
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
-module(geef_oid).
|
||||
|
||||
-ifdef(TEST).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
-endif.
|
||||
|
||||
-include("geef_records.hrl").
|
||||
|
||||
-export([parse/1, fmt/1]).
|
||||
|
||||
-spec fmt(oid()) -> binary().
|
||||
@@ -12,3 +17,13 @@ fmt(#oid{oid=Oid}) ->
|
||||
parse(Sha) ->
|
||||
Oid = geef:oid_parse(Sha),
|
||||
#oid{oid=Oid}.
|
||||
|
||||
-ifdef(TEST).
|
||||
|
||||
back_and_forth_test() ->
|
||||
?assertMatch(<<"d71c6ff702e75247ce29c51279d78a7a202f5cc9">>,
|
||||
fmt(parse(<<"d71c6ff702e75247ce29c51279d78a7a202f5cc9">>))),
|
||||
?assertMatch(<<"d71c6ff702e75247ce29c51279d78a7a202f5cc9">>,
|
||||
fmt(parse("d71c6ff702e75247ce29c51279d78a7a202f5cc9"))).
|
||||
|
||||
-endif.
|
||||
|
||||
Reference in New Issue
Block a user