Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added ok case when it adds up

  • Loading branch information...
commit 9b983841c27cc46dd77422dbf95d336e21146e2c 1 parent 98a2556
Gianfranco Alongi authored
View
4 One/Solution/src/ros_analyzer.erl
@@ -9,7 +9,9 @@ analyze(#ros{total = Total,entries = Entries}) ->
X when X < 0 ->
{error,{underflow,X}};
X when X > 0 ->
- {error,{overflow,X}}
+ {error,{overflow,X}};
+ 0 ->
+ ok
end.
sum_entries([]) -> 0;
View
9 One/Solution/test/ros_analyzer_tests.erl
@@ -17,6 +17,15 @@ analysis_overflow_discrepancy_test() ->
Analysis_input = #ros{entries = Entries,
total = 9},
?assertEqual({error,{overflow,1}},ros_analyzer:analyze(Analysis_input)).
+
+analysis_ok_test() ->
+ Entries = [#entry{type = "a",
+ sold = 1,
+ projected = 10}],
+ Analysis_input = #ros{entries = Entries,
+ total = 10},
+ ?assertEqual(ok,ros_analyzer:analyze(Analysis_input)).
+
Please sign in to comment.
Something went wrong with that request. Please try again.