% testMinPerProb.m
% Taylor King for CISC106, sect 80, 10/1/2007

% Test formula to calculate the average
% number of minutes per problem

%%%%%%%%%%%%%%%%%%%%%%%%
% define the tolerance %
%%%%%%%%%%%%%%%%%%%%%%%%

% tolerance is "how far away from teh expected value: the result
% is allowed to be.  Since the calculation involves a square root,
% not all inputs will produce results that can be represented exactly.

tolerance = 0.001;

%%%%%%%%%%%%%%%%%
% Run the tests %
%%%%%%%%%%%%%%%%%

% Test 1

actual = minPerProb(10,10);
expected = (1);

diff = abs(expected-actual);

if (diff < tolerance)
  disp('test 1 passed');
else
  disp('test 1 failed');
  expected
  actual
end

% Test 2

actual = minPerProb(4,2);
expected = (2);

diff = abs(expected-actual);

if (diff < tolerance)
  disp('test 1 passed');
else
  disp('test 1 failed');
  expected
  actual
end

%end testMinPerProb
