% testSumUpToK.m  P. Conrad for CISC106  10/25/2006
% regression testing for sumUpToK function


passed = 0;
failed = 0;

if (sumUpToK([3 4 2 1],3) == 9)
  passed = passed + 1;
else
  failed = failed + 1;
end;

 
if (sumUpToK([3 4 2 1],4) == 10)
  passed = passed + 1;
else
  failed = failed + 1;
end;

if (sumUpToK([3 4 2 1],1) == 3)
  passed = passed + 1;
else
  failed = failed + 1;
end;


if (sumUpToK([3 4 2 1],0) == 0)
  passed = passed + 1;
else
  failed = failed + 1;
end;

if (sumUpToK([3 4 2 1],-1) == 0)
  passed = passed + 1;
else
  failed = failed + 1;
end;

if (sumUpToK([3 4 2 1],5) == 0)
  passed = passed + 1;
else
  failed = failed + 1;
end;


fprintf('Results for sumUpToK:\n')
fprintf(' %d tests passed, %d tests failed\n',passed,failed);

