%% testDeg2rad.m   test deg2rad.m
% S. Vincent for CISC106, sect 80, 09/14/2007

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

% tolerance is "how far away from the expected value" the result
% is allowed to be.  We have to have some tolerance because the
% calculation involves pi, which is always a approximation.

tolerance = 0.01;

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

% Test 1
actual = deg2rad(90);
expected = 1.57;

diff = abs(expected-actual);

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

% Test 2

expected =pi;
actual = deg2rad(180);
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 testDeg2rad.m