{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":44521,"title":"Make your own Test Suite (part 3)","description":"In this task you need to imagine that you — _yes, YOU_ — have developed a problem on Cody for _me_ to solve, and now *you need to implement a robust Test Suite* to check whether _my_ submitted solutions meet _your_ requirements or not, and to be fairly assured that I am not trying to 'game' the system.  \r\n\r\nSo the tables are turned!  You are now in the role of Tester!  I am in the role of Player!  \r\n\r\nThe problem you've set me is to:\r\n\r\n* output the *sine* of an angle, when the angle is specified in degrees as a (scalar) \u003chttps://au.mathworks.com/help/matlab/ref/double.html |double|\u003e, with no restriction in the domain,   \r\n* *without* using |regexp| or |regexpi| or |ans|, \r\n* *within* less than 0.01 seconds (10 milliseconds).\r\n\r\nYou provide me with the following example for the function defined as |s = SINE(a)|:\r\n\r\n % INPUT\r\n a = 45 % degrees\r\n % OUTPUT\r\n s = 1/sqrt(2)\r\n\r\nNow I have responded by submitting a large number of purported 'solutions', some of which are _reasonably accurate_, and others which are either too imprecise or else logically flawed.  \r\n\r\nYour Test Suite (contained within _your_ function |testSuite|) must address each of the elements of your problem specification:  \r\n\r\n# Check that my submitted code reliably returns *sufficiently accurate* values for sine of many different angles.  Use the \u003chttps://au.mathworks.com/help/matlab/ref/assert.html |assert|\u003e function.  \r\n# Ensure that the returned *data type* is suitable.  \r\n# You *cannot* use (or mention) the functions |sind|, |sin|, |cscd| or |cosd| in your Test Suite;  any other functions are allowed.  [ _MOTIVATION:  You shouldn't be exposing an efficient way of solving the problem within your Test Suite, otherwise I can just copy and paste your solution and submit it as my own!_ ]\r\n# You must check that I *haven't used* \"regexp\" or \"regexpi\" or \"ans\".  You could try using the \u003chttps://au.mathworks.com/help/coursework/ug/assessfunctionabsence.html |assessFunctionAbsence|\u003e function in the form |assessFunctionAbsence(..., 'FileName','SINE.m')|, or else you could try 'manually' opening the file |SINE.m| that corresponds to my submitted solution and then parsing it for occurrence of the prohibited function/variable.  \r\n# You must check that my code returns a result within *less than 0.01 seconds* (for a single input of an arbitrary angle).  You could use \u003chttps://au.mathworks.com/help/matlab/ref/tic.html |tic|\u003e \u0026 \u003chttps://au.mathworks.com/help/matlab/ref/toc.html |toc|\u003e or \u003chttps://au.mathworks.com/help/matlab/ref/timeit.html |timeit|\u003e, or a variety of other MATLAB functions (but not |cputime| in this case).  If your Test Suite claims that my submission runs slowly, then you must be confident that it is truly caused only by inefficiency in my submitted code, *not* just general/erratic overheads in 'queuing' or suchlike on the Cody servers.  \r\n# Your |assert| (or other) function must throw \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44357 errors/exceptions\u003e with the following *|error message| text* contents.\r\n\r\n* 'Incorrect value' if the output is too inaccurate.\r\n* 'Incorrect data type' if the output is not appropriate.\r\n* 'Too slow' if my submitted code is too slow.\r\n* 'Banned word' if my submitted code contains the |regexp| or |regexpi| functions or the \u003chttps://au.mathworks.com/help/matlab/ref/ans.html |ans|\u003e variable.  For _this_ infringement, _additional_ text can _also_ (optionally!) be present in the message — for example, 'You cannot do that!  Banned word (regexp/regexpi)' would also be acceptable.\r\n\r\nWhen creating a Test Suite for a Cody problem it is a good habit to try to anticipate the tactics that diverse Players might employ!  \r\n\r\nSee also:\r\n\r\n* \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44631 Problem 44631\u003e (part *0*)\r\n* \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44617 Problem 44617\u003e (part *1*)\r\n* \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44616 Problem 44616\u003e (part *2*)","description_html":"\u003cp\u003eIn this task you need to imagine that you — \u003ci\u003eyes, YOU\u003c/i\u003e — have developed a problem on Cody for \u003ci\u003eme\u003c/i\u003e to solve, and now \u003cb\u003eyou need to implement a robust Test Suite\u003c/b\u003e to check whether \u003ci\u003emy\u003c/i\u003e submitted solutions meet \u003ci\u003eyour\u003c/i\u003e requirements or not, and to be fairly assured that I am not trying to 'game' the system.\u003c/p\u003e\u003cp\u003eSo the tables are turned!  You are now in the role of Tester!  I am in the role of Player!\u003c/p\u003e\u003cp\u003eThe problem you've set me is to:\u003c/p\u003e\u003cul\u003e\u003cli\u003eoutput the \u003cb\u003esine\u003c/b\u003e of an angle, when the angle is specified in degrees as a (scalar) \u003ca href = \"https://au.mathworks.com/help/matlab/ref/double.html\"\u003e\u003ctt\u003edouble\u003c/tt\u003e\u003c/a\u003e, with no restriction in the domain,\u003c/li\u003e\u003cli\u003e\u003cb\u003ewithout\u003c/b\u003e using \u003ctt\u003eregexp\u003c/tt\u003e or \u003ctt\u003eregexpi\u003c/tt\u003e or \u003ctt\u003eans\u003c/tt\u003e,\u003c/li\u003e\u003cli\u003e\u003cb\u003ewithin\u003c/b\u003e less than 0.01 seconds (10 milliseconds).\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYou provide me with the following example for the function defined as \u003ctt\u003es = SINE(a)\u003c/tt\u003e:\u003c/p\u003e\u003cpre\u003e % INPUT\r\n a = 45 % degrees\r\n % OUTPUT\r\n s = 1/sqrt(2)\u003c/pre\u003e\u003cp\u003eNow I have responded by submitting a large number of purported 'solutions', some of which are \u003ci\u003ereasonably accurate\u003c/i\u003e, and others which are either too imprecise or else logically flawed.\u003c/p\u003e\u003cp\u003eYour Test Suite (contained within \u003ci\u003eyour\u003c/i\u003e function \u003ctt\u003etestSuite\u003c/tt\u003e) must address each of the elements of your problem specification:\u003c/p\u003e\u003col\u003e\u003cli\u003eCheck that my submitted code reliably returns \u003cb\u003esufficiently accurate\u003c/b\u003e values for sine of many different angles.  Use the \u003ca href = \"https://au.mathworks.com/help/matlab/ref/assert.html\"\u003e\u003ctt\u003eassert\u003c/tt\u003e\u003c/a\u003e function.\u003c/li\u003e\u003cli\u003eEnsure that the returned \u003cb\u003edata type\u003c/b\u003e is suitable.\u003c/li\u003e\u003cli\u003eYou \u003cb\u003ecannot\u003c/b\u003e use (or mention) the functions \u003ctt\u003esind\u003c/tt\u003e, \u003ctt\u003esin\u003c/tt\u003e, \u003ctt\u003ecscd\u003c/tt\u003e or \u003ctt\u003ecosd\u003c/tt\u003e in your Test Suite;  any other functions are allowed.  [ \u003ci\u003eMOTIVATION:  You shouldn't be exposing an efficient way of solving the problem within your Test Suite, otherwise I can just copy and paste your solution and submit it as my own!\u003c/i\u003e ]\u003c/li\u003e\u003cli\u003eYou must check that I \u003cb\u003ehaven't used\u003c/b\u003e \"regexp\" or \"regexpi\" or \"ans\".  You could try using the \u003ca href = \"https://au.mathworks.com/help/coursework/ug/assessfunctionabsence.html\"\u003e\u003ctt\u003eassessFunctionAbsence\u003c/tt\u003e\u003c/a\u003e function in the form \u003ctt\u003eassessFunctionAbsence(..., 'FileName','SINE.m')\u003c/tt\u003e, or else you could try 'manually' opening the file \u003ctt\u003eSINE.m\u003c/tt\u003e that corresponds to my submitted solution and then parsing it for occurrence of the prohibited function/variable.\u003c/li\u003e\u003cli\u003eYou must check that my code returns a result within \u003cb\u003eless than 0.01 seconds\u003c/b\u003e (for a single input of an arbitrary angle).  You could use \u003ca href = \"https://au.mathworks.com/help/matlab/ref/tic.html\"\u003e\u003ctt\u003etic\u003c/tt\u003e\u003c/a\u003e \u0026 \u003ca href = \"https://au.mathworks.com/help/matlab/ref/toc.html\"\u003e\u003ctt\u003etoc\u003c/tt\u003e\u003c/a\u003e or \u003ca href = \"https://au.mathworks.com/help/matlab/ref/timeit.html\"\u003e\u003ctt\u003etimeit\u003c/tt\u003e\u003c/a\u003e, or a variety of other MATLAB functions (but not \u003ctt\u003ecputime\u003c/tt\u003e in this case).  If your Test Suite claims that my submission runs slowly, then you must be confident that it is truly caused only by inefficiency in my submitted code, \u003cb\u003enot\u003c/b\u003e just general/erratic overheads in 'queuing' or suchlike on the Cody servers.\u003c/li\u003e\u003cli\u003eYour \u003ctt\u003eassert\u003c/tt\u003e (or other) function must throw \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44357\"\u003eerrors/exceptions\u003c/a\u003e with the following \u003cb\u003e\u003ctt\u003eerror message\u003c/tt\u003e text\u003c/b\u003e contents.\u003c/li\u003e\u003c/ol\u003e\u003cul\u003e\u003cli\u003e'Incorrect value' if the output is too inaccurate.\u003c/li\u003e\u003cli\u003e'Incorrect data type' if the output is not appropriate.\u003c/li\u003e\u003cli\u003e'Too slow' if my submitted code is too slow.\u003c/li\u003e\u003cli\u003e'Banned word' if my submitted code contains the \u003ctt\u003eregexp\u003c/tt\u003e or \u003ctt\u003eregexpi\u003c/tt\u003e functions or the \u003ca href = \"https://au.mathworks.com/help/matlab/ref/ans.html\"\u003e\u003ctt\u003eans\u003c/tt\u003e\u003c/a\u003e variable.  For \u003ci\u003ethis\u003c/i\u003e infringement, \u003ci\u003eadditional\u003c/i\u003e text can \u003ci\u003ealso\u003c/i\u003e (optionally!) be present in the message — for example, 'You cannot do that!  Banned word (regexp/regexpi)' would also be acceptable.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eWhen creating a Test Suite for a Cody problem it is a good habit to try to anticipate the tactics that diverse Players might employ!\u003c/p\u003e\u003cp\u003eSee also:\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44631\"\u003eProblem 44631\u003c/a\u003e (part \u003cb\u003e0\u003c/b\u003e)\u003c/li\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44617\"\u003eProblem 44617\u003c/a\u003e (part \u003cb\u003e1\u003c/b\u003e)\u003c/li\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44616\"\u003eProblem 44616\u003c/a\u003e (part \u003cb\u003e2\u003c/b\u003e)\u003c/li\u003e\u003c/ul\u003e","function_template":"function dummy = testSuite()\r\n    \r\n    %% Test 1 — test outputs of submitted SINE function for various input values\r\n    % RATIONALE:  Computing SINE requires relatively simple code, \r\n    %             as the focus in the present task is on implementing a robust Test Suite.  \r\n    % MOTIVATION:  I could be submitting lazy code that only works for \r\n    %              a small number of angles, if that's all you test.\r\n    assert( isequal( SINE(45), 1/sqrt(2) ) , '' )\r\n    assert( isequal( SINE(45), 1/sqrt(2) ) , '' )\r\n    assert( isequal( SINE(45), 1/sqrt(2) ) , '' )\r\n    \r\n    \r\n    %% Test 2 — test for use/presence of  \"regexp\" or \"regexpi\" or \"ans\" in the submission\r\n    % MOTIVATION:  The functions regexp and regexpi are sometimes pertinent to efficient solution of a problem, \r\n    %              but at other times are used to artificially decrease the size of a Cody submission.\r\n    %              If I'm using regexp or regexpi for *this* problem of yours (where neither is relevant), \r\n    %              then it's probably because I'm trying to 'cheat' to get a smaller Cody score.\r\n    %              Use of the ans variable is also generally employed purely to decrease\r\n    %              Cody size, at the expense of clarity in the code.  \r\n    assessFunctionAbsence( '' , 'FileName','SINE.m' )\r\n\r\n    \r\n    %% Test 3 — check the speed of execution of the submission \r\n    % MOTIVATION:  Some code that is rated as \"small\" on Cody is actually quite computationally inefficient, \r\n    %              but it is possible to 'manually' enforce a requirement for Cody submissions to be at least \r\n    %              moderately efficient.  See e.g. Cody Problems 44351, 44356 \u0026 44383.  \r\n    %              So this will balance the Cody focus on small code 'size' with \r\n    %              the desire to ensure code is also computationally efficient.\r\n    toc\r\n    timeit( SINE(45) )\r\n    duration = tic\r\n    assert( duration , '' )\r\n\r\nend\r\n\r\n%{\r\nNOTE:  \r\nThe text \"dummy = \" was added to this Function Template, \r\nbecause Cody was generating a spurious error, namely\r\n        Your problem cannot be published until you:\r\n        •Edit the function name in the test suite to match the function name in the function template\r\nHowever, in the Reference Solution it was confirmed to be unnecessary.  \r\n%}\r\n\r\n%{\r\nFOOTNOTE:  \r\nAlthough 10 milliseconds may not seem like a slow execution time, \r\ncomputing the sine of an angle is a very common task, and a general program \r\nmight need to compute it hundreds, thousands or even millions of times.  \r\nIn the latter case, if each computation of sine were to take more than 10 \r\nmilliseconds, then the hypothetical program would run for several hours.  \r\nBy way of comparison, for a 1×1000000 vector input MATLAB's built-in sin \r\nfunction is currently taking a total of about 10 to 25 milliseconds on Cody, \r\nwhile sind is taking about 20 to 50 milliseconds._  \r\n%}","test_suite":"%% Timing\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle);\\n');\r\nfprintf(fileID,'   pause(0.012);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Too slow') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Use of ans\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function ans = SINE(angle)\\n');\r\nfprintf(fileID,'   sind(angle);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    e.message\r\n    assert( contains(e.message, 'Banned word') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Possible false alarm for use of ans\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   % This is a simple problem:  the answer only takes one line!\\n');\r\nfprintf(fileID,'   s = sind(angle);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'pass';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Use of regexp/regexpi (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle);\\n');\r\nfprintf(fileID,'   dummy = regexp(''Test text'', ''t'');\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    e.message\r\n    assert( contains(e.message, 'Banned word') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Use of regexp/regexpi (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle);\\n');\r\nfprintf(fileID,'   dummy = regexpi(''Test text'', ''t'');\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    e.message\r\n    assert( contains(e.message, 'Banned word') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Ensure no \"sind\" or \"sin\" or \"cosd\" in _your_ Test Suite\r\n% NOTE:  You may notice that the user function has been named \"SINE\", \r\n%        in uppercase.  That is an extra precaution to avoid accidentally \r\n%        triggering an error due to a banned 'word' (sequence of characters).  \r\n%        Careful choice of code to check for banned _functions_ is better!  \r\nassessFunctionAbsence('sind', 'FileName','testSuite.m')\r\nassessFunctionAbsence('sin',  'FileName','testSuite.m')\r\nassessFunctionAbsence('cscd', 'FileName','testSuite.m')\r\nassessFunctionAbsence('cosd', 'FileName','testSuite.m')\r\n\r\n\r\n%% Exactly right\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'pass';\r\nstatus = 'pass';\r\n                    testSuite()\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Sufficiently close (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle + eps(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'pass';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Sufficiently close (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sin(angle * pi / 180);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'pass';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Sufficiently close (III)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = 1 ./ cscd(angle);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'pass';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Insufficiently close (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sin(angle * 3.14 / 180);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Insufficiently close (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sin(angle * (22/7) / 180);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Sufficiently close (III)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle + 10000*eps(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Completely wrong\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = cosd(angle);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Partly wrong (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle*sign(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Partly wrong (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = -sind(angle*sign(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Partly wrong (III)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle)*sign(sind(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% 'Fixed' angles\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(fix(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% 'Unfixed' angles\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   inc=0;\\n');\r\nfprintf(fileID,'   if mod(angle,1)==0, inc=1; end;\\n');\r\nfprintf(fileID,'   s = sind(angle + inc);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Altered data type (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nif rand() \u003c 0.5,\r\n    fprintf(fileID,'   s = int8(sind(angle));\\n');\r\nelse\r\n    fprintf(fileID,'   s = int16(sind(angle));\\n');\r\nend;\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') | ...\r\n            isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Altered data type (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nif rand() \u003c 0.5,\r\n    fprintf(fileID,'   s = int32(sind(angle));\\n');\r\nelse\r\n    fprintf(fileID,'   s = int64(sind(angle));\\n');\r\nend;\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') | ...\r\n            isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Altered data type (III)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(double(int32(angle)));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Total nonsense (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = \"ratio\";\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Total nonsense (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = \"?\";\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Total nonsense (III)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = {1:1E4};\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Wrong data type\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = {sind(angle)};\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":"2018-04-18T14:04:26.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-02-13T12:05:07.000Z","updated_at":"2018-05-11T13:20:58.000Z","published_at":"2018-02-20T13:11:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn this task you need to imagine that you —\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eyes, YOU\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e — have developed a problem on Cody for\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eme\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to solve, and now\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eyou need to implement a robust Test Suite\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to check whether\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emy\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e submitted solutions meet\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eyour\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e requirements or not, and to be fairly assured that I am not trying to 'game' the system.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo the tables are turned! You are now in the role of Tester! I am in the role of Player!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe problem you've set me is to:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eoutput the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esine\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of an angle, when the angle is specified in degrees as a (scalar)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/double.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edouble\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, with no restriction in the domain,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ewithout\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e using\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexpi\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eans\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ewithin\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e less than 0.01 seconds (10 milliseconds).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou provide me with the following example for the function defined as\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003es = SINE(a)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ % INPUT\\n a = 45 % degrees\\n % OUTPUT\\n s = 1/sqrt(2)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNow I have responded by submitting a large number of purported 'solutions', some of which are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ereasonably accurate\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and others which are either too imprecise or else logically flawed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour Test Suite (contained within\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eyour\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e function\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etestSuite\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) must address each of the elements of your problem specification:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCheck that my submitted code reliably returns\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esufficiently accurate\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e values for sine of many different angles. Use the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/assert.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassert\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEnsure that the returned\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edata type\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is suitable.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecannot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e use (or mention) the functions\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esind\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esin\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecscd\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecosd\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in your Test Suite; any other functions are allowed. [\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eMOTIVATION: You shouldn't be exposing an efficient way of solving the problem within your Test Suite, otherwise I can just copy and paste your solution and submit it as my own!\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou must check that I\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ehaven't used\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \\\"regexp\\\" or \\\"regexpi\\\" or \\\"ans\\\". You could try using the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/coursework/ug/assessfunctionabsence.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassessFunctionAbsence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e function in the form\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassessFunctionAbsence(..., 'FileName','SINE.m')\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, or else you could try 'manually' opening the file\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSINE.m\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that corresponds to my submitted solution and then parsing it for occurrence of the prohibited function/variable.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou must check that my code returns a result within\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eless than 0.01 seconds\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (for a single input of an arbitrary angle). You could use\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/tic.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etic\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e \u0026amp;\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/toc.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etoc\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/timeit.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etimeit\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, or a variety of other MATLAB functions (but not\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecputime\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in this case). If your Test Suite claims that my submission runs slowly, then you must be confident that it is truly caused only by inefficiency in my submitted code,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e just general/erratic overheads in 'queuing' or suchlike on the Cody servers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassert\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (or other) function must throw\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44357\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eerrors/exceptions\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e with the following\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eerror message\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e text\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e contents.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'Incorrect value' if the output is too inaccurate.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'Incorrect data type' if the output is not appropriate.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'Too slow' if my submitted code is too slow.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'Banned word' if my submitted code contains the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexpi\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e functions or the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/ans.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eans\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e variable. For\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ethis\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e infringement,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eadditional\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e text can\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ealso\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (optionally!) be present in the message — for example, 'You cannot do that! Banned word (regexp/regexpi)' would also be acceptable.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhen creating a Test Suite for a Cody problem it is a good habit to try to anticipate the tactics that diverse Players might employ!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee also:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44631\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44631\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (part\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e0\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44617\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44617\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (part\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44616\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44616\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (part\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":44521,"title":"Make your own Test Suite (part 3)","description":"In this task you need to imagine that you — _yes, YOU_ — have developed a problem on Cody for _me_ to solve, and now *you need to implement a robust Test Suite* to check whether _my_ submitted solutions meet _your_ requirements or not, and to be fairly assured that I am not trying to 'game' the system.  \r\n\r\nSo the tables are turned!  You are now in the role of Tester!  I am in the role of Player!  \r\n\r\nThe problem you've set me is to:\r\n\r\n* output the *sine* of an angle, when the angle is specified in degrees as a (scalar) \u003chttps://au.mathworks.com/help/matlab/ref/double.html |double|\u003e, with no restriction in the domain,   \r\n* *without* using |regexp| or |regexpi| or |ans|, \r\n* *within* less than 0.01 seconds (10 milliseconds).\r\n\r\nYou provide me with the following example for the function defined as |s = SINE(a)|:\r\n\r\n % INPUT\r\n a = 45 % degrees\r\n % OUTPUT\r\n s = 1/sqrt(2)\r\n\r\nNow I have responded by submitting a large number of purported 'solutions', some of which are _reasonably accurate_, and others which are either too imprecise or else logically flawed.  \r\n\r\nYour Test Suite (contained within _your_ function |testSuite|) must address each of the elements of your problem specification:  \r\n\r\n# Check that my submitted code reliably returns *sufficiently accurate* values for sine of many different angles.  Use the \u003chttps://au.mathworks.com/help/matlab/ref/assert.html |assert|\u003e function.  \r\n# Ensure that the returned *data type* is suitable.  \r\n# You *cannot* use (or mention) the functions |sind|, |sin|, |cscd| or |cosd| in your Test Suite;  any other functions are allowed.  [ _MOTIVATION:  You shouldn't be exposing an efficient way of solving the problem within your Test Suite, otherwise I can just copy and paste your solution and submit it as my own!_ ]\r\n# You must check that I *haven't used* \"regexp\" or \"regexpi\" or \"ans\".  You could try using the \u003chttps://au.mathworks.com/help/coursework/ug/assessfunctionabsence.html |assessFunctionAbsence|\u003e function in the form |assessFunctionAbsence(..., 'FileName','SINE.m')|, or else you could try 'manually' opening the file |SINE.m| that corresponds to my submitted solution and then parsing it for occurrence of the prohibited function/variable.  \r\n# You must check that my code returns a result within *less than 0.01 seconds* (for a single input of an arbitrary angle).  You could use \u003chttps://au.mathworks.com/help/matlab/ref/tic.html |tic|\u003e \u0026 \u003chttps://au.mathworks.com/help/matlab/ref/toc.html |toc|\u003e or \u003chttps://au.mathworks.com/help/matlab/ref/timeit.html |timeit|\u003e, or a variety of other MATLAB functions (but not |cputime| in this case).  If your Test Suite claims that my submission runs slowly, then you must be confident that it is truly caused only by inefficiency in my submitted code, *not* just general/erratic overheads in 'queuing' or suchlike on the Cody servers.  \r\n# Your |assert| (or other) function must throw \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44357 errors/exceptions\u003e with the following *|error message| text* contents.\r\n\r\n* 'Incorrect value' if the output is too inaccurate.\r\n* 'Incorrect data type' if the output is not appropriate.\r\n* 'Too slow' if my submitted code is too slow.\r\n* 'Banned word' if my submitted code contains the |regexp| or |regexpi| functions or the \u003chttps://au.mathworks.com/help/matlab/ref/ans.html |ans|\u003e variable.  For _this_ infringement, _additional_ text can _also_ (optionally!) be present in the message — for example, 'You cannot do that!  Banned word (regexp/regexpi)' would also be acceptable.\r\n\r\nWhen creating a Test Suite for a Cody problem it is a good habit to try to anticipate the tactics that diverse Players might employ!  \r\n\r\nSee also:\r\n\r\n* \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44631 Problem 44631\u003e (part *0*)\r\n* \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44617 Problem 44617\u003e (part *1*)\r\n* \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44616 Problem 44616\u003e (part *2*)","description_html":"\u003cp\u003eIn this task you need to imagine that you — \u003ci\u003eyes, YOU\u003c/i\u003e — have developed a problem on Cody for \u003ci\u003eme\u003c/i\u003e to solve, and now \u003cb\u003eyou need to implement a robust Test Suite\u003c/b\u003e to check whether \u003ci\u003emy\u003c/i\u003e submitted solutions meet \u003ci\u003eyour\u003c/i\u003e requirements or not, and to be fairly assured that I am not trying to 'game' the system.\u003c/p\u003e\u003cp\u003eSo the tables are turned!  You are now in the role of Tester!  I am in the role of Player!\u003c/p\u003e\u003cp\u003eThe problem you've set me is to:\u003c/p\u003e\u003cul\u003e\u003cli\u003eoutput the \u003cb\u003esine\u003c/b\u003e of an angle, when the angle is specified in degrees as a (scalar) \u003ca href = \"https://au.mathworks.com/help/matlab/ref/double.html\"\u003e\u003ctt\u003edouble\u003c/tt\u003e\u003c/a\u003e, with no restriction in the domain,\u003c/li\u003e\u003cli\u003e\u003cb\u003ewithout\u003c/b\u003e using \u003ctt\u003eregexp\u003c/tt\u003e or \u003ctt\u003eregexpi\u003c/tt\u003e or \u003ctt\u003eans\u003c/tt\u003e,\u003c/li\u003e\u003cli\u003e\u003cb\u003ewithin\u003c/b\u003e less than 0.01 seconds (10 milliseconds).\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYou provide me with the following example for the function defined as \u003ctt\u003es = SINE(a)\u003c/tt\u003e:\u003c/p\u003e\u003cpre\u003e % INPUT\r\n a = 45 % degrees\r\n % OUTPUT\r\n s = 1/sqrt(2)\u003c/pre\u003e\u003cp\u003eNow I have responded by submitting a large number of purported 'solutions', some of which are \u003ci\u003ereasonably accurate\u003c/i\u003e, and others which are either too imprecise or else logically flawed.\u003c/p\u003e\u003cp\u003eYour Test Suite (contained within \u003ci\u003eyour\u003c/i\u003e function \u003ctt\u003etestSuite\u003c/tt\u003e) must address each of the elements of your problem specification:\u003c/p\u003e\u003col\u003e\u003cli\u003eCheck that my submitted code reliably returns \u003cb\u003esufficiently accurate\u003c/b\u003e values for sine of many different angles.  Use the \u003ca href = \"https://au.mathworks.com/help/matlab/ref/assert.html\"\u003e\u003ctt\u003eassert\u003c/tt\u003e\u003c/a\u003e function.\u003c/li\u003e\u003cli\u003eEnsure that the returned \u003cb\u003edata type\u003c/b\u003e is suitable.\u003c/li\u003e\u003cli\u003eYou \u003cb\u003ecannot\u003c/b\u003e use (or mention) the functions \u003ctt\u003esind\u003c/tt\u003e, \u003ctt\u003esin\u003c/tt\u003e, \u003ctt\u003ecscd\u003c/tt\u003e or \u003ctt\u003ecosd\u003c/tt\u003e in your Test Suite;  any other functions are allowed.  [ \u003ci\u003eMOTIVATION:  You shouldn't be exposing an efficient way of solving the problem within your Test Suite, otherwise I can just copy and paste your solution and submit it as my own!\u003c/i\u003e ]\u003c/li\u003e\u003cli\u003eYou must check that I \u003cb\u003ehaven't used\u003c/b\u003e \"regexp\" or \"regexpi\" or \"ans\".  You could try using the \u003ca href = \"https://au.mathworks.com/help/coursework/ug/assessfunctionabsence.html\"\u003e\u003ctt\u003eassessFunctionAbsence\u003c/tt\u003e\u003c/a\u003e function in the form \u003ctt\u003eassessFunctionAbsence(..., 'FileName','SINE.m')\u003c/tt\u003e, or else you could try 'manually' opening the file \u003ctt\u003eSINE.m\u003c/tt\u003e that corresponds to my submitted solution and then parsing it for occurrence of the prohibited function/variable.\u003c/li\u003e\u003cli\u003eYou must check that my code returns a result within \u003cb\u003eless than 0.01 seconds\u003c/b\u003e (for a single input of an arbitrary angle).  You could use \u003ca href = \"https://au.mathworks.com/help/matlab/ref/tic.html\"\u003e\u003ctt\u003etic\u003c/tt\u003e\u003c/a\u003e \u0026 \u003ca href = \"https://au.mathworks.com/help/matlab/ref/toc.html\"\u003e\u003ctt\u003etoc\u003c/tt\u003e\u003c/a\u003e or \u003ca href = \"https://au.mathworks.com/help/matlab/ref/timeit.html\"\u003e\u003ctt\u003etimeit\u003c/tt\u003e\u003c/a\u003e, or a variety of other MATLAB functions (but not \u003ctt\u003ecputime\u003c/tt\u003e in this case).  If your Test Suite claims that my submission runs slowly, then you must be confident that it is truly caused only by inefficiency in my submitted code, \u003cb\u003enot\u003c/b\u003e just general/erratic overheads in 'queuing' or suchlike on the Cody servers.\u003c/li\u003e\u003cli\u003eYour \u003ctt\u003eassert\u003c/tt\u003e (or other) function must throw \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44357\"\u003eerrors/exceptions\u003c/a\u003e with the following \u003cb\u003e\u003ctt\u003eerror message\u003c/tt\u003e text\u003c/b\u003e contents.\u003c/li\u003e\u003c/ol\u003e\u003cul\u003e\u003cli\u003e'Incorrect value' if the output is too inaccurate.\u003c/li\u003e\u003cli\u003e'Incorrect data type' if the output is not appropriate.\u003c/li\u003e\u003cli\u003e'Too slow' if my submitted code is too slow.\u003c/li\u003e\u003cli\u003e'Banned word' if my submitted code contains the \u003ctt\u003eregexp\u003c/tt\u003e or \u003ctt\u003eregexpi\u003c/tt\u003e functions or the \u003ca href = \"https://au.mathworks.com/help/matlab/ref/ans.html\"\u003e\u003ctt\u003eans\u003c/tt\u003e\u003c/a\u003e variable.  For \u003ci\u003ethis\u003c/i\u003e infringement, \u003ci\u003eadditional\u003c/i\u003e text can \u003ci\u003ealso\u003c/i\u003e (optionally!) be present in the message — for example, 'You cannot do that!  Banned word (regexp/regexpi)' would also be acceptable.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eWhen creating a Test Suite for a Cody problem it is a good habit to try to anticipate the tactics that diverse Players might employ!\u003c/p\u003e\u003cp\u003eSee also:\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44631\"\u003eProblem 44631\u003c/a\u003e (part \u003cb\u003e0\u003c/b\u003e)\u003c/li\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44617\"\u003eProblem 44617\u003c/a\u003e (part \u003cb\u003e1\u003c/b\u003e)\u003c/li\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44616\"\u003eProblem 44616\u003c/a\u003e (part \u003cb\u003e2\u003c/b\u003e)\u003c/li\u003e\u003c/ul\u003e","function_template":"function dummy = testSuite()\r\n    \r\n    %% Test 1 — test outputs of submitted SINE function for various input values\r\n    % RATIONALE:  Computing SINE requires relatively simple code, \r\n    %             as the focus in the present task is on implementing a robust Test Suite.  \r\n    % MOTIVATION:  I could be submitting lazy code that only works for \r\n    %              a small number of angles, if that's all you test.\r\n    assert( isequal( SINE(45), 1/sqrt(2) ) , '' )\r\n    assert( isequal( SINE(45), 1/sqrt(2) ) , '' )\r\n    assert( isequal( SINE(45), 1/sqrt(2) ) , '' )\r\n    \r\n    \r\n    %% Test 2 — test for use/presence of  \"regexp\" or \"regexpi\" or \"ans\" in the submission\r\n    % MOTIVATION:  The functions regexp and regexpi are sometimes pertinent to efficient solution of a problem, \r\n    %              but at other times are used to artificially decrease the size of a Cody submission.\r\n    %              If I'm using regexp or regexpi for *this* problem of yours (where neither is relevant), \r\n    %              then it's probably because I'm trying to 'cheat' to get a smaller Cody score.\r\n    %              Use of the ans variable is also generally employed purely to decrease\r\n    %              Cody size, at the expense of clarity in the code.  \r\n    assessFunctionAbsence( '' , 'FileName','SINE.m' )\r\n\r\n    \r\n    %% Test 3 — check the speed of execution of the submission \r\n    % MOTIVATION:  Some code that is rated as \"small\" on Cody is actually quite computationally inefficient, \r\n    %              but it is possible to 'manually' enforce a requirement for Cody submissions to be at least \r\n    %              moderately efficient.  See e.g. Cody Problems 44351, 44356 \u0026 44383.  \r\n    %              So this will balance the Cody focus on small code 'size' with \r\n    %              the desire to ensure code is also computationally efficient.\r\n    toc\r\n    timeit( SINE(45) )\r\n    duration = tic\r\n    assert( duration , '' )\r\n\r\nend\r\n\r\n%{\r\nNOTE:  \r\nThe text \"dummy = \" was added to this Function Template, \r\nbecause Cody was generating a spurious error, namely\r\n        Your problem cannot be published until you:\r\n        •Edit the function name in the test suite to match the function name in the function template\r\nHowever, in the Reference Solution it was confirmed to be unnecessary.  \r\n%}\r\n\r\n%{\r\nFOOTNOTE:  \r\nAlthough 10 milliseconds may not seem like a slow execution time, \r\ncomputing the sine of an angle is a very common task, and a general program \r\nmight need to compute it hundreds, thousands or even millions of times.  \r\nIn the latter case, if each computation of sine were to take more than 10 \r\nmilliseconds, then the hypothetical program would run for several hours.  \r\nBy way of comparison, for a 1×1000000 vector input MATLAB's built-in sin \r\nfunction is currently taking a total of about 10 to 25 milliseconds on Cody, \r\nwhile sind is taking about 20 to 50 milliseconds._  \r\n%}","test_suite":"%% Timing\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle);\\n');\r\nfprintf(fileID,'   pause(0.012);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Too slow') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Use of ans\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function ans = SINE(angle)\\n');\r\nfprintf(fileID,'   sind(angle);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    e.message\r\n    assert( contains(e.message, 'Banned word') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Possible false alarm for use of ans\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   % This is a simple problem:  the answer only takes one line!\\n');\r\nfprintf(fileID,'   s = sind(angle);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'pass';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Use of regexp/regexpi (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle);\\n');\r\nfprintf(fileID,'   dummy = regexp(''Test text'', ''t'');\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    e.message\r\n    assert( contains(e.message, 'Banned word') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Use of regexp/regexpi (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle);\\n');\r\nfprintf(fileID,'   dummy = regexpi(''Test text'', ''t'');\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    e.message\r\n    assert( contains(e.message, 'Banned word') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Ensure no \"sind\" or \"sin\" or \"cosd\" in _your_ Test Suite\r\n% NOTE:  You may notice that the user function has been named \"SINE\", \r\n%        in uppercase.  That is an extra precaution to avoid accidentally \r\n%        triggering an error due to a banned 'word' (sequence of characters).  \r\n%        Careful choice of code to check for banned _functions_ is better!  \r\nassessFunctionAbsence('sind', 'FileName','testSuite.m')\r\nassessFunctionAbsence('sin',  'FileName','testSuite.m')\r\nassessFunctionAbsence('cscd', 'FileName','testSuite.m')\r\nassessFunctionAbsence('cosd', 'FileName','testSuite.m')\r\n\r\n\r\n%% Exactly right\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'pass';\r\nstatus = 'pass';\r\n                    testSuite()\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Sufficiently close (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle + eps(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'pass';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Sufficiently close (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sin(angle * pi / 180);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'pass';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Sufficiently close (III)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = 1 ./ cscd(angle);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'pass';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Insufficiently close (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sin(angle * 3.14 / 180);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Insufficiently close (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sin(angle * (22/7) / 180);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Sufficiently close (III)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle + 10000*eps(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Completely wrong\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = cosd(angle);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Partly wrong (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle*sign(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Partly wrong (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = -sind(angle*sign(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Partly wrong (III)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(angle)*sign(sind(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% 'Fixed' angles\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(fix(angle));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% 'Unfixed' angles\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   inc=0;\\n');\r\nfprintf(fileID,'   if mod(angle,1)==0, inc=1; end;\\n');\r\nfprintf(fileID,'   s = sind(angle + inc);\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Altered data type (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nif rand() \u003c 0.5,\r\n    fprintf(fileID,'   s = int8(sind(angle));\\n');\r\nelse\r\n    fprintf(fileID,'   s = int16(sind(angle));\\n');\r\nend;\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') | ...\r\n            isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Altered data type (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nif rand() \u003c 0.5,\r\n    fprintf(fileID,'   s = int32(sind(angle));\\n');\r\nelse\r\n    fprintf(fileID,'   s = int64(sind(angle));\\n');\r\nend;\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') | ...\r\n            isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Altered data type (III)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = sind(double(int32(angle)));\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect value') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Total nonsense (I)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = \"ratio\";\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Total nonsense (II)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = \"?\";\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Total nonsense (III)\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = {1:1E4};\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )\r\n\r\n\r\n%% Wrong data type\r\nfileID = fopen('SINE.m','w');\r\nfprintf(fileID,'function s = SINE(angle)\\n');\r\nfprintf(fileID,'   s = {sind(angle)};\\n');\r\nfclose(fileID);\r\nstatus_correct = 'fail';\r\nstatus = 'pass';\r\ntry\r\n    testSuite()\r\ncatch e\r\n    status = 'fail'\r\n    assert( isequal(e.message, 'Incorrect data type') , 'Wrong message' )\r\nend\r\nassert( isequal(status, status_correct) , 'Wrong status' )","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":"2018-04-18T14:04:26.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-02-13T12:05:07.000Z","updated_at":"2018-05-11T13:20:58.000Z","published_at":"2018-02-20T13:11:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn this task you need to imagine that you —\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eyes, YOU\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e — have developed a problem on Cody for\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eme\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to solve, and now\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eyou need to implement a robust Test Suite\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to check whether\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emy\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e submitted solutions meet\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eyour\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e requirements or not, and to be fairly assured that I am not trying to 'game' the system.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo the tables are turned! You are now in the role of Tester! I am in the role of Player!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe problem you've set me is to:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eoutput the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esine\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of an angle, when the angle is specified in degrees as a (scalar)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/double.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edouble\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, with no restriction in the domain,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ewithout\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e using\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexpi\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eans\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ewithin\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e less than 0.01 seconds (10 milliseconds).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou provide me with the following example for the function defined as\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003es = SINE(a)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ % INPUT\\n a = 45 % degrees\\n % OUTPUT\\n s = 1/sqrt(2)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNow I have responded by submitting a large number of purported 'solutions', some of which are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ereasonably accurate\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and others which are either too imprecise or else logically flawed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour Test Suite (contained within\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eyour\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e function\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etestSuite\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) must address each of the elements of your problem specification:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCheck that my submitted code reliably returns\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esufficiently accurate\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e values for sine of many different angles. Use the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/assert.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassert\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEnsure that the returned\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edata type\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is suitable.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecannot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e use (or mention) the functions\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esind\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esin\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecscd\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecosd\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in your Test Suite; any other functions are allowed. [\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eMOTIVATION: You shouldn't be exposing an efficient way of solving the problem within your Test Suite, otherwise I can just copy and paste your solution and submit it as my own!\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e ]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou must check that I\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ehaven't used\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \\\"regexp\\\" or \\\"regexpi\\\" or \\\"ans\\\". You could try using the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/coursework/ug/assessfunctionabsence.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassessFunctionAbsence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e function in the form\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassessFunctionAbsence(..., 'FileName','SINE.m')\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, or else you could try 'manually' opening the file\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSINE.m\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that corresponds to my submitted solution and then parsing it for occurrence of the prohibited function/variable.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou must check that my code returns a result within\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eless than 0.01 seconds\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (for a single input of an arbitrary angle). You could use\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/tic.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etic\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e \u0026amp;\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/toc.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etoc\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/timeit.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etimeit\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, or a variety of other MATLAB functions (but not\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecputime\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in this case). If your Test Suite claims that my submission runs slowly, then you must be confident that it is truly caused only by inefficiency in my submitted code,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e just general/erratic overheads in 'queuing' or suchlike on the Cody servers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassert\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (or other) function must throw\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44357\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eerrors/exceptions\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e with the following\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eerror message\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e text\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e contents.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'Incorrect value' if the output is too inaccurate.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'Incorrect data type' if the output is not appropriate.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'Too slow' if my submitted code is too slow.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'Banned word' if my submitted code contains the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e or\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexpi\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e functions or the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/ans.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eans\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e variable. For\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ethis\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e infringement,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eadditional\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e text can\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ealso\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (optionally!) be present in the message — for example, 'You cannot do that! Banned word (regexp/regexpi)' would also be acceptable.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhen creating a Test Suite for a Cody problem it is a good habit to try to anticipate the tactics that diverse Players might employ!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee also:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44631\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44631\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (part\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e0\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44617\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44617\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (part\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44616\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44616\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (part\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"assessfunctionabsence\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"assessfunctionabsence\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"assessfunctionabsence\"","","\"","assessfunctionabsence","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f3d95997580\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f3d959974e0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f3d95996c20\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f3d95997800\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f3d95997760\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f3d959976c0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f3d95997620\u003e":"tag:\"assessfunctionabsence\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f3d95997620\u003e":"tag:\"assessfunctionabsence\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"assessfunctionabsence\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"assessfunctionabsence\"","","\"","assessfunctionabsence","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f3d95997580\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f3d959974e0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f3d95996c20\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f3d95997800\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f3d95997760\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f3d959976c0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f3d95997620\u003e":"tag:\"assessfunctionabsence\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f3d95997620\u003e":"tag:\"assessfunctionabsence\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":44521,"difficulty_rating":"medium"}]}}