Add some skeleton for unit testing. Start with template objects.
This commit is contained in:
29
upnp/unittest/main.c
Normal file
29
upnp/unittest/main.c
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "templates/templates.h"
|
||||
|
||||
int (*tests[])(void) = {
|
||||
templates,
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
int n = (sizeof tests) / (sizeof tests[0]);
|
||||
int result;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
result = tests[i]();
|
||||
printf("Test number %3d: %s.\n", i + 1, !result ? "PASS" : "FAIL");
|
||||
ret += result;
|
||||
}
|
||||
printf("\n"
|
||||
"Failed in %d tests.\n"
|
||||
"Passed in %d tests.\n",
|
||||
ret, n - ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user