Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "highscoretable.h"
- void testControl(HighscoreTable *scoreTable){
- printf("Initial:\n");
- scoreTable->report();
- }
- void testScore(HighscoreTable *scoreTable, int score, const char *name, const char *note){
- scoreTable->insert(score, name);
- printf("\nAfter insert (score = %i, name = %s): %s\n", score, name, note);
- scoreTable->report();
- }
- void testScoreNotHighEnough(HighscoreTable *scoreTable){
- testScore(scoreTable, 99, "CHU", "(Nothing should change)");
- }
- void testScoreIsRight(HighscoreTable *scoreTable){
- testScore(scoreTable, 101, "NII", "(should appear at #5)");
- }
- void testSuperHighScore(HighscoreTable *scoreTable){
- testScore(scoreTable, 40000, "BRA", "(should appear at #1)");
- }
- int main(){
- HighscoreTable *scoreTable = new HighscoreTable();
- testControl(scoreTable);
- testScoreNotHighEnough(scoreTable);
- testScoreIsRight(scoreTable);
- testSuperHighScore(scoreTable);
- delete scoreTable;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement