root/ggpa/TestTools.h
| Revision 1, 1.9 kB (checked in by pantley2, 4 years ago) |
|---|
| Line | |
|---|---|
| 1 | /* |
| 2 | * TestTools.h |
| 3 | * Simple functions to make testing easier |
| 4 | */ |
| 5 | |
| 6 | #ifndef TESTTOOLS_H |
| 7 | #define TESTTOOLS_H |
| 8 | |
| 9 | #include <iostream> |
| 10 | using namespace std; |
| 11 | |
| 12 | /* |
| 13 | * assertTrue |
| 14 | * Parameters: value - a boolean value that should be true |
| 15 | * message - a message to send if value is not true |
| 16 | * Return value: none |
| 17 | * If value is not true, then it will send message as an error message, and |
| 18 | * then terminate the program with an error. Otherwise, it will do nothing |
| 19 | */ |
| 20 | void assertTrue(bool value, string message = ""); |
| 21 | |
| 22 | /* |
| 23 | * assertEquals |
| 24 | * Parameters: value1 - a string that is the first value to compare |
| 25 | * value2 - a string that is the second value to compare |
| 26 | * message - a message to send if the values are not equal |
| 27 | * Return value: none |
| 28 | * If value1 != value2, it will output message as an error message, and then |
| 29 | * send an error containing the two values. Otherwise it will do nothing. |
| 30 | */ |
| 31 | void assertEquals(string value1, string value2, string message = ""); |
| 32 | |
| 33 | /* |
| 34 | * assertEquals |
| 35 | * Parameters: value1 - a int that is the first value to compare |
| 36 | * value2 - a int that is the second value to compare |
| 37 | * message - a message to send if the values are not equal |
| 38 | * Return value: none |
| 39 | * If value1 != value2, it will output message as an error message, and then |
| 40 | * send an error containing the two values. Otherwise it will do nothing. |
| 41 | */ |
| 42 | void assertEquals(int value1, int value2, string message = ""); |
| 43 | |
| 44 | /* |
| 45 | * assertEquals |
| 46 | * Parameters: value1 - a double that is the first value to compare |
| 47 | * value2 - a double that is the second value to compare |
| 48 | * message - a message to send if the values are not equal |
| 49 | * Return value: none |
| 50 | * If value1 != value2, it will output message as an error message, and then |
| 51 | * send an error containing the two values. Otherwise it will do nothing. |
| 52 | */ |
| 53 | void assertEquals(double value1, double value2, string message = ""); |
| 54 | |
| 55 | #endif |
| 56 |
Note: See TracBrowser for help on using the browser.
