Testing, Debugging, and
Verification |
TDA567/DIT082, LP2, HT2017 |
Exercises Week 3 - Property-Based (stateless functions)
|
Input generation and property-based testing
For each of the following classes, implement functions that generate input for test cases and write the properties that should be tested.
- List Reversal
This class implements an in-place reversal of arrays. An array is reversed by swapping the first element of the array with the last element, the second with the second-to-last, and so forth.
- Implement a function that generates random arrays.
- Come up with properties that test the function and fix any bugs you find.
- Base64Test
This class implements Base64 encoding and decoding.
A description of Base64 can be found on Wikipedia.
- Implement a function that generates random input to the Base64 function; note the assumption on the encoding function.
- Come up with a property that should hold on Base64 encoding/decoding and implement it in the test function.
- Greatest Common Divisor
This class implements two ways of computing the greatest common divisor of two numbers.
Both methods are described on Wikipedia.
- Implement a function that generates random values for the functions, complying with the assumptions of both methods.
- Come up with properties that test these functions. If you find a bug, compare the wikipedia pseudo codes to the implementation.
|
|
Home
| Course
| Schedule
| Exam
| Exercises
| Labs
| Evaluation
| Tools
| Links
|
Atze van der Ploeg,
Nov 3, 2016
|