Cody

Solution 1513647

Submitted on 2 May 2018
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
% Hacking of the Test Suite is not allowed! % Additional restrictions will be added if necessary. assessFunctionAbsence({'!', 'assert', 'evalin', 'assignin', 'system', 'dos', 'unix'}, 'FileName', 'waitForMe.m') assert( isempty( regexp(fileread('waitForMe.m'),'[!]+','match') ) , 'No exclamation marks (!) allowed!!!')

2   Pass
t_correct = 1000; c = cputime; tic; waitForMe(t_correct); t = toc e = cputime - c assert( abs(t_correct - t*1000) <= 0.5 ) assert( e*1000 / t_correct <= 0.05 )

t = 0.9998 e = 0.0100

3   Fail
t_correct = 2000; c = cputime; tic; waitForMe(t_correct); t = toc e = cputime - c assert( abs(t_correct - t*1000) <= 0.5 ) assert( e*1000 / t_correct <= 0.05 )

t = 2.0009 e = 0.0100

Assertion failed.

4   Pass
t_correct = 1000; for r = 1 : 3 c = cputime; tic; waitForMe(t_correct); t = toc e = cputime - c assert( abs(t_correct - t*1000) <= 0.5 ) assert( e*1000 / t_correct <= 0.05 ) end;

t = 0.9995 e = 0 t = 0.9996 e = 0.0100 t = 1.0001 e = 0

5   Fail
t_correct = 2000; for r = 1 : 2 c = cputime; tic; waitForMe(t_correct); t = toc e = cputime - c assert( abs(t_correct - t*1000) <= 0.5 ) assert( e*1000 / t_correct <= 0.05 ) end;

t = 2.0011 e = 0

Assertion failed.