Cody

Solution 1721668

Submitted on 6 Feb 2019
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
%assessFunctionAbsence('sind', 'FileName','testSuite.m')

2   Fail
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = sind(angle);\n'); fclose(fileID); status_correct = 'pass'; status = 'pass'; testSuite() try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

Cannot find an exact (case-sensitive) match for 'sine' The closest match is: SINE in /users/mss.system.zxlAEa/SINE.m Error in testSuite (line 13) assert( isequal( SINE(45), sine(45) ) ) Error in Test2 (line 7) testSuite()

3   Fail
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = sind(angle + eps(angle));\n'); fclose(fileID); status_correct = 'pass'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

Wrong status

4   Fail
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = sin(angle * pi / 180);\n'); fclose(fileID); status_correct = 'pass'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

Wrong status

5   Fail
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = 1 ./ cscd(angle);\n'); fclose(fileID); status_correct = 'pass'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

Wrong status

6   Pass
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = sin(angle * 3.14 / 180);\n'); fclose(fileID); status_correct = 'fail'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

7   Pass
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = sin(angle * (22/7) / 180);\n'); fclose(fileID); status_correct = 'fail'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

8   Pass
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = sind(angle + 10000*eps(angle));\n'); fclose(fileID); status_correct = 'fail'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

9   Pass
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = cosd(angle);\n'); fclose(fileID); status_correct = 'fail'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

10   Pass
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = sind(angle*sign(angle));\n'); fclose(fileID); status_correct = 'fail'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

11   Pass
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = -sind(angle*sign(angle));\n'); fclose(fileID); status_correct = 'fail'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

12   Pass
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = sind(angle)*sign(sind(angle));\n'); fclose(fileID); status_correct = 'fail'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

13   Pass
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' s = sind(fix(angle));\n'); fclose(fileID); status_correct = 'fail'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'

14   Pass
fileID = fopen('SINE.m','w'); fprintf(fileID,'function s = SINE(angle)\n'); fprintf(fileID,' inc=0;\n'); fprintf(fileID,' if mod(angle,1)==0, inc=1; end;\n'); fprintf(fileID,' s = sind(angle + inc);\n'); fclose(fileID); status_correct = 'fail'; status = 'pass'; try testSuite() catch e status = 'fail' end assert( isequal(status, status_correct) , 'Wrong status' )

status = 'fail'