PA 8001 2014 Practical 1
Objectives
There are three objectives for this practical:
- Experiment with concurrency (without any underlying support) and observe its issues
- Experiment with a unit testing framework (such as CUnit)
- Get more insight into the working of the Raspberry Pi, particularly with respect to input and output
Instructions
Submit a single .zip file on blackboard with separate folders, each containing the solutions to the below-specified parts.
For each function in the code, you need to write evidence of test-driven development, both in terms of comments (description, pre- and post-condition and properties) and unit testing test suites (e.g., in CUnit, see below).
Part 1: Prime Factorization
Part 1.1. Write the specification (description, pre- and post-condition, test-cases) for the function factorize() with the following signature:
struct factorization {
int factor;
struct factorisation *next;
};
factorization * factrorize ( int );
Part 1.2. Implement its test suite using a unit testing framework such as CUnit.
Note that different development environments come with their built in unit testing framework and you can use any of those instead of CUnit.
If you decide to use CUnit, please download it from its sourceforge repository, unpack it and install it in your local directory. Here is a useful discussion about installing CUnit.
Review the examples provided at the CUnit repository or the tutorial by Nielsen and Skou.
Implement a test suite for factorization, based on the description provided in part 1.1.
Part 1.3 Implement factorize(int) and run all your tests.