% testJerk.m
% D. Pavlick for CISC106, sect 80, 10/01/2007

% Test formula to calculate the jerk using change in time and change in acceleration 

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

tolerance = 0.01;

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

% Test 1


actual = jerk(0,1,0,5);
expected = 5;

diff = abs(expected-actual);

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

% Test 2

actual = jerk(0,10,1,2);
expected = .1;

diff = abs(expected-actual);

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

% end testJerk.m






