Add some skeleton for unit testing. Start with template objects.

This commit is contained in:
Marcelo Roberto Jimenez
2010-10-21 00:43:33 -02:00
parent 45461f738d
commit 3ec269c872
12 changed files with 229 additions and 1 deletions

29
upnp/unittest/main.c Normal file
View 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;
}