From 95fb9015f44774778e2d1143b289c76dcdfb4842 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Fri, 17 Oct 2025 03:17:03 +0200 Subject: Added a self test --- FICS/copyfile.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/FICS/copyfile.c b/FICS/copyfile.c index 787db11..524a036 100644 --- a/FICS/copyfile.c +++ b/FICS/copyfile.c @@ -12,6 +12,8 @@ #include "copyfile.h" +#define SELF_TEST 0 + bool fics_copyfile(const char *p1, const char *p2) { @@ -75,3 +77,13 @@ is_regular_file(const char *path) return false; return (stat(path, &sb) == 0 && S_ISREG(sb.st_mode)); } + +#if SELF_TEST +int +main(int argc, char *argv[]) +{ + if (argc != 3) + errx(1, "bogus number of args"); + return (fics_copyfile(argv[1], argv[2]) ? EXIT_SUCCESS : EXIT_FAILURE); +} +#endif -- cgit v1.2.3