COMP 2521 – Ass 2 : Testing your API Implementations
[ Part-1 and 2 | Part-3 ]
Please note that testing an API implementation is very important and crucial part of designing and implementing an API. We offer the following testing interfaces (for all three APIs) for you to get started, however note that they only test basic cases. Importantly,
you need to add more advanced test cases and properly test your API implementations,
the auto-marking program will use more advanced test cases that are not included in the test cases provided to you.
Download and unzip the following file, it will create a directory named “Ass2_testing”.
Ass2_Testing.zip
Notes:
We have included “dummy” files for each API: Dijkstra_template.c, CentralityMeasures_template.c and LanceWilliamsHAC_template.c. You need to move them to say: Dijkstra.c, CentralityMeasures.c and LanceWilliamsHAC.c respectively. This is to make sure that you do not override your solution files!
You need to copy your solutions ( Dijkstra.c, CentralityMeasures.c and LanceWilliamsHAC.c ) in Ass2_Testing and test them as described below.
In order to understand how testing is carried out, please open and read the files used by the testing interfaces (like Makefile, test*.c, test*.sh, etc.).
Part-1 and Part-2 Dijkstra
If you just run ./testDijkstra [input file] such as ./testDijkstra graphs/1.in you will get the shortest path output for your search on the input graph. If you want to compare the output against a sample correct solution use the provided script which compares against the correct output in /dijkstraPaths
do ./testDijkstra.sh 1 to test your search on graph 1 to run on all graphs use ./testDijkstra.sh
Centrality
If you just run ./testCentralityMeasure you will get a help message on how to use the test interface.
Usage: ./testCentralityMeasures [file] [flag]
Valid Flags:
c : closeness centrality
b : betweenness centrality
bn : betweenness centrality normalised
If you wanted to see the output for your “closeness centrality ” function for the 2nd test graph you would run:
./testCentralityMeasures graphs/2.in c
If you wanted to see the output for your “betweenness centrality” function for the 2nd test graph you would run:
./testCentralityMeasures graphs/2.in b
If you wanted to see the output for your “betweenness centrality normalised” function for the 2nd test graph you would run:
./testCentralityMeasures graphs/2.in bn
If you want to compare the output against a sample correct expected solution, use the provided script which compares against the correct expected output in
/graphMeasurements
do ./testCentrality.sh 1 c to view “closeness centrality” on graph 1
do ./testCentrality.sh 1 to view all centrality measurements on graph 1 do ./testCentrality.sh to view all centrality measurements on all graphs
Part-3
You can use one of the following commands to test your LanceWilliamsHAC API. The five graphs used for the following are ./graphs/1.in, ./graphs/2.in, …, ./graphs/4.in.
% ./testLW.sh 1
% ./testLW.sh 2
% ./testLW.sh 3
% ./testLW.sh 4
To get more information on the test cases covered, please read the client testing program testLanceWilliamsHAC.c used for testing your API.