mirror of
https://github.com/troglobit/libite.git
synced 2026-12-05 21:58:36 +00:00
test: refactor, each test in separate func
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
ac7b4194cf
commit
63cf8867c5
1 file changed
+23
-8
+23
-8
@@ -5,6 +5,13 @@
|
|||||||
#define ERR(fmt, args...) { printf(fmt, ##args); rc = 1; }
|
#define ERR(fmt, args...) { printf(fmt, ##args); rc = 1; }
|
||||||
#define ERRX(fmt, args...) { printf(fmt, ##args); rc = 1; }
|
#define ERRX(fmt, args...) { printf(fmt, ##args); rc = 1; }
|
||||||
|
|
||||||
|
static char *files[] = {
|
||||||
|
"/etc/passwd", "/tmp/mypwd", "/tmp/mypwd",
|
||||||
|
"/etc/passwd", "/tmp/", "/tmp/passwd",
|
||||||
|
"/etc/passwd", "/tmp", "/tmp/passwd",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static int sz()
|
static int sz()
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@@ -28,14 +35,8 @@ static int sz()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
static int check_fcopyfile()
|
||||||
{
|
{
|
||||||
char *files[] = {
|
|
||||||
"/etc/passwd", "/tmp/mypwd", "/tmp/mypwd",
|
|
||||||
"/etc/passwd", "/tmp/", "/tmp/passwd",
|
|
||||||
"/etc/passwd", "/tmp", "/tmp/passwd",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
FILE *src, *dst;
|
FILE *src, *dst;
|
||||||
int rc, i;
|
int rc, i;
|
||||||
|
|
||||||
@@ -76,6 +77,13 @@ int main(void)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int check_copyfile()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
printf("\n=>Start testing copyfile()\n");
|
printf("\n=>Start testing copyfile()\n");
|
||||||
for (i = 0; files[i]; i += 3) {
|
for (i = 0; files[i]; i += 3) {
|
||||||
printf("copyfile(%s, %s)\t", files[i], files[i + 1]);
|
printf("copyfile(%s, %s)\t", files[i], files[i + 1]);
|
||||||
@@ -89,5 +97,12 @@ int main(void)
|
|||||||
erase(files[i + 2]);
|
erase(files[i + 2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sz();
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
return check_fcopyfile() ||
|
||||||
|
check_copyfile() ||
|
||||||
|
sz();
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user