Skip to content

Commit

Permalink
add is_valid util funs
Browse files Browse the repository at this point in the history
  • Loading branch information
andreineculau committed Dec 28, 2014
1 parent 57cfe50 commit a5eb19f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/katt_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
, escape_regex/1
, maybe_json_string/1
, run_result_to_mochijson3/1
, is_valid/3
, validate/3
, is_valid/5
, validate/5
, enumerate/1
]).
Expand Down Expand Up @@ -191,6 +193,22 @@ transaction_failure_to_mochijson3({Reason, {Key0, Expected0, Actual0}}) ->
, {actual, Actual}
]}.

is_valid(ParentKey, E, A) ->
case validate(ParentKey, E, A) of
{pass, _} ->
true;
_ ->
false
end.

is_valid(ParentKey, E, A, Unexpected, Callbacks) ->
case validate(ParentKey, E, A, Unexpected, Callbacks) of
{pass, _} ->
true;
_ ->
false
end.

validate(ParentKey, E, A) ->
validate_primitive(ParentKey, E, A).

Expand Down

0 comments on commit a5eb19f

Please sign in to comment.