Sunday’s assignment requires you to generate test values that test all branches of your program including errors and all currencies. Doing this should help you determine if your program is coded correctly. Follow through your design with a set of inputs and see what you come up with for outputs. Here is a template of a table to use if you want to but you are not limited to this form just make sure you use enough values (25-35 should be good).
Generating test values that cover all branches of a program, including errors and different currencies, is an essential step in ensuring the correctness of the program. By providing a range of inputs and observing the corresponding outputs, one can identify any potential issues or bugs in the code.
To accomplish this, it is advisable to create a comprehensive set of test cases that covers a wide variety of scenarios. The test cases should include both valid and invalid inputs, as well as test cases that exercise all logical branches of the program.
A table can be used to organize the test cases and their corresponding inputs and outputs. While the template provided is suitable, it is not mandatory to use it. The most important aspect is to include enough test values, typically ranging from 25 to 35, to adequately cover the program’s functionality.
Here is an example of a table that can be used to record the test cases:
| Test Case | Input | Expected Output |
| 1 | $50 | Converted to €43.36 |
| 2 | ¥1000| Converted to $91.46 |
| 3 | £200| Converted to $260.00 |
| 4 | €100| Error: Invalid currency |
| 5 | $-50| Error: Negative amount |
| 6 | – | Error: No input provided |
| 7 | $0 | Converted to €0.00 |
| 8 | ¥0 | Converted to $0.00 |
| 9 | £0 | Converted to $0.00 |
| 10 | €0 | Converted to $0.00 |
| 11 | $9999999999999999999 | Error: Amount exceeds maximum value |
| … | … | … |
| 35 | $50 | Converted to €43.36 |
In this example, test case 1 tests the conversion of $50 to Euros, while test case 4 checks for an error when attempting to convert an invalid currency. Test case 5 tests for a negative amount, and test case 11 verifies that the program correctly identifies when the amount exceeds the maximum value.
It is crucial to create test cases that cover various scenarios, such as different currencies, extreme values, and potential error conditions. By thoroughly testing the program with a diverse and extensive set of test cases, one can gain confidence in the correctness and robustness of the implemented code.
Remember that the provided table is just an example, and you can customize the layout and content based on the specific requirements of your program.