diff options
Diffstat (limited to 'plugins/tests/test_check_swap.c')
| -rw-r--r-- | plugins/tests/test_check_swap.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/plugins/tests/test_check_swap.c b/plugins/tests/test_check_swap.c new file mode 100644 index 00000000..94d56ce7 --- /dev/null +++ b/plugins/tests/test_check_swap.c | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | |||
| 2 | #include "../check_swap.d/check_swap.h" | ||
| 3 | #include "../../tap/tap.h" | ||
| 4 | |||
| 5 | int verbose = 0; | ||
| 6 | |||
| 7 | void print_usage(void) {} | ||
| 8 | void print_help(swap_config config) { (void)config; } | ||
| 9 | |||
| 10 | const char *progname = "test_check_swap"; | ||
| 11 | |||
| 12 | int main(void) { | ||
| 13 | swap_result test_data = getSwapFromProcMeminfo("./var/proc_meminfo"); | ||
| 14 | |||
| 15 | plan_tests(4); | ||
| 16 | |||
| 17 | ok(test_data.errorcode == 0, "Test whether we manage to retrieve swap data"); | ||
| 18 | ok(test_data.metrics.total == 34233905152, "Is the total Swap correct"); | ||
| 19 | ok(test_data.metrics.free == 34233905152, "Is the free Swap correct"); | ||
| 20 | ok(test_data.metrics.used == 0, "Is the used Swap correct"); | ||
| 21 | } | ||
