Add unit test for tree

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-06-06 15:32:35 +02:00
1 parent d8cb477861
commit 2d6e8850a2
4 files changed
+23 -24

No files matched your search

-22
View File
@@ -120,30 +120,8 @@ int tree(char *path, int show_perms)
return descend(path, show_perms, "");
}
#ifdef UNITTEST
#include "lite.h"
int main(void)
{
int i, result = 0;
struct { char *path; int fail; } arr[] = {
{ "/etc/passwd", -1 },
{ "/dev", 0 },
{ "/sbin", 0 },
};
for (i = 0; i < NELEMS(arr); i++) {
if (tree(arr[i].path, 1) != arr[i].fail)
result++;
}
return result;
}
#endif
/**
* Local Variables:
* compile-command: "make V=1 -f tree.mk"
* indent-tabs-mode: t
* c-file-style: "linux"
* End: