Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 98a2556535
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (15 sloc) 0.481 kB
-module(ros_analyzer).
-include("include/ros.hrl").
-export([analyze/1]).
-spec(analyze(#ros{}) -> {error,{underflow,integer()}}).
analyze(#ros{total = Total,entries = Entries}) ->
Entries_Total = sum_entries(Entries),
case Entries_Total - Total of
X when X < 0 ->
{error,{underflow,X}};
X when X > 0 ->
{error,{overflow,X}}
end.
sum_entries([]) -> 0;
sum_entries([#entry{projected = Projected}|T]) ->
Projected + sum_entries(T).
Jump to Line
Something went wrong with that request. Please try again.