Problem 44617. Make your own Test Suite (part 1)
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 prepare a simple Test Suite to 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 Test Suite (contained within your function testSuite) must address each of the elements of your problem specification:
- 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 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! ]
When creating a Test Suite for a Cody problem it is a good habit to try to anticipate the tactics that diverse Players might employ! Therefore the above specification is merely a starting point. You will develop more robust Test Suites in:
- Problem 44616 (part 2)
- Problem 44521 (part 3)
Alternatively, if even this Problem seems daunting, you may want to start with Problem 44631 (part 0).
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers3
Suggested Problems
-
1718 Solvers
-
given 3 sides, find area of this triangle
797 Solvers
-
Getting the absolute index from a matrix
246 Solvers
-
Set some matrix elements to zero
536 Solvers
-
How many monitors are connected ?
152 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!