% testPressure.m   test pressure.m
% D. Kee for CISC106, sect 80, 10/01/2007

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

% tolerance is "how far away from the expected value" the result
% is allowed to be.  Here, we can have a very small tolerance,
% because the values should be almost exact.

tolerance = 0.00001;

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

% Test 1

expected = 83.14472;
actual = pressure(10,100);
diff = abs(expected-actual);

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

% Test 2

expected = 34.64363333;
actual = pressure(72,300);
diff = abs(expected-actual);

if (diff < tolerance)
  disp('test 2 passed');
else
  % signal that test failed, and print both expected and actual
  disp('test 2 failed');
  expected
  actual
end
  

% end testAreaOfPizza.m