Skip to content
Browse files

Added ok case when it adds up

  • Loading branch information...
1 parent 98a2556 commit 9b983841c27cc46dd77422dbf95d336e21146e2c Gianfranco Alongi committed Feb 19, 2012
Showing with 12 additions and 1 deletion.
  1. +3 −1 One/Solution/src/ros_analyzer.erl
  2. +9 −0 One/Solution/test/ros_analyzer_tests.erl
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)).
+

0 comments on commit 9b98384

Please sign in to comment.
Something went wrong with that request. Please try again.