Penguin
Annotated edit history of Aym version 6, including all changes. View license author blame.
Rev Author # Line
5 CraigBox 1 Aym is a specification-based UnitTesting framework. It uses in-source comments consisting of a functional specification language implementation of an algorithm as an oracle against which to test the correctness of an implementation of said algorithm. This is being written by GianPerrone, AlastairPorter and Simon Ware as their project for COMP134 at WaikatoUniversity.
4 GianPerrone 2
3 !A Really Bad Example
4
5 Aym Specification:
6
6 AlastairPorter 7 <pre>
4 GianPerrone 8 function sum(x) of type integer returning integer
9 let sum(0) = 0
10 let sum(x) = x + sum(x-1)
6 AlastairPorter 11 </pre>
4 GianPerrone 12
13 C++ Implementation:
14
6 AlastairPorter 15 <pre>
4 GianPerrone 16 int sum( int x )
17 {
18 int count = 0;
19 for(int i = 0; i<x; i++) {
20 count += i;
21 }
22 return count;
23 }
6 AlastairPorter 24 </pre>
4 GianPerrone 25
26 Notice that these two functions return completely different results! The idea is that the unit-testing portion of the project would catch this and inform you of the input, expected output and actual output.
27
6 AlastairPorter 28 [Aym] also supports the idea of "watches", whereby __internal__ values of the specification and implementation can be made to match, not just returned results. This is facilitated by the use of a function ''~AymWatch'', of type string * 'a -> 'a. Using the above example again, one might insert a watch into the last line of the specification such as:
4 GianPerrone 29
6 AlastairPorter 30 <pre>
31 let sum(x) = ~AymWatch("sumwatch", x) + sum(x-1)
32 </pre>
4 GianPerrone 33
34 And then the implementation would have a line added to it such as:
35
6 AlastairPorter 36 <pre>
37 ~AymWatch("sumwatch", i);
38 </pre>
4 GianPerrone 39
40 The unit-testing framework will ensure that the values match at each update.
41
42 Aym is GPLish. If you want a copy (''why?''), talk to GianPerrone or AlastairPorter.