Problem 44631. Make your own Test Suite (part 0)
Have no knowledge of "floatingpoint numbers"? Read the documentation, and/or try Problem 44690 first.
——————————————————————————————————————————
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 draft a naïve Test Suite as the first step in developing a more robust Test Suite that would check whether my submitted solutions meet your requirements or not.
So the tables are turned! You are now in the role of Tester! I am in the role of Player!
The problem you've set me is to:
 output the sine of an angle, when the angle is specified in degrees as a (scalar) double, with no restriction in the domain.
You provide me with the following example for the function defined as s = SINE(a):
% INPUT a = 45 % degrees % OUTPUT s = 1/sqrt(2)
Now 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.
Your final Test Suite (contained within your function testSuite) will have to address several aspects arising in your problem specification. However, for this 'first draft' you are creating a naïve Test Suite with only one requirement:
 Check that my submitted code reliably returns sufficiently accurate values for sine of many different angles. Use the assert function to generate errors/exceptions if the values are not sufficiently accurate.
You can use the functions sind, sin, etc. in this draft Test Suite, if you want — even though this would be bad practice in your final Test Suite!
Thus, the above specification is merely a starting point. You will develop more robust Test Suites in:
 Problem 44617 (part 1)
 Problem 44616 (part 2)
 Problem 44521 (part 3)
Solution Stats
Problem Comments

6 Comments
Hint: when the Problem Statement uses phrases like "reasonably accurate" and "sufficiently accurate", it is a clue that your Test Suite should not require 'equality' to any 'exact values', but rather should include a small tolerance to allow for unavoidable floatingpoint imprecision.
It was very hard to understand what do you mean.
I'm glad you managed to find a solution. I tried to provide a few extra clues, such as in the Solution Template and in the comment from 02 June. Players will benefit from looking up the Documentation on functions such as "assert", "isequal", etc., along with information on "FloatingPoint Numbers" at https://au.mathworks.com/help/matlab/matlab_prog/floatingpointnumbers.html . There are also many other resources online, such as www.floatingpointgui.de . For some people this should be a simple problem to implement their existing knowledge; for other people, it should be a learning process. —DIV
Since assert is not working anymore, it is necessary to use the dummy variable and the function error.
Rafael, I had not been not aware that the assert() function has been disallowed on Cody. Thankyou for alerting us to that.
Previously it was working, and actually it is the function that ideally 'should' be used, so I am not going to alter the problem statement.
However I agree that with the current Cody prohibition on players using assert() in their solutions, the error() function will have to be used instead.
However, I can confirm that it is *not* necessary to use any dummy variables at all.
P.S. I believe assert() was disallowed because of a small number of Cody players who brazenly cheated their way through numerous problems. Ideally there should be a switch in Cody to allow the assert() function to be used for specific individual problems, in which case there are some special measures that can be implemented to prevent such exploits. For example, running the command "! rm v assert.m" (without quotation marks) in the Test Suite.
David, I agree 100% that certain functions should be allowed in individual problems, if selected by the problem author.
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems

Find the numeric mean of the prime numbers in a matrix.
8882 Solvers

1298 Solvers

389 Solvers

find the maximum element of the matrix
491 Solvers

439 Solvers
More from this Author32
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!