aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/tests/ansi/strftime.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-07 17:28:52 -0500
committerIan Moffett <ian@osmora.org>2024-03-07 18:24:51 -0500
commitf5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 (patch)
tree93b156621dc0303816b37f60ba88051b702d92f6 /lib/mlibc/tests/ansi/strftime.c
parentbd5969fc876a10b18613302db7087ef3c40f18e1 (diff)
build: Build mlibc + add distclean target
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/mlibc/tests/ansi/strftime.c')
-rw-r--r--lib/mlibc/tests/ansi/strftime.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/lib/mlibc/tests/ansi/strftime.c b/lib/mlibc/tests/ansi/strftime.c
deleted file mode 100644
index 69ec642..0000000
--- a/lib/mlibc/tests/ansi/strftime.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <string.h>
-#include <time.h>
-#include <assert.h>
-#include <locale.h>
-#include <stdio.h>
-
-int main() {
- // Date representation depends on locale, here only C is tested.
- // Maybe consider testing more locales?
- if (setlocale (LC_ALL, "C") == NULL) {
- fputs("strftime testcase could not set locale, errors may be expected!", stderr);
- }
-
- char timebuf[16];
- char result[16] = " 8";
- struct tm tm;
- tm.tm_sec = 0;
- tm.tm_min = 17;
- tm.tm_hour = 17;
- tm.tm_mday = 8;
- tm.tm_mon = 2;
- tm.tm_year = 121;
- tm.tm_wday = 2;
- tm.tm_yday = 39;
- strftime(timebuf, sizeof(timebuf), "%e", &tm);
- assert(!strcmp(timebuf, result));
-
- memset(timebuf, 0, sizeof(timebuf));
- strftime(timebuf, sizeof(timebuf), "%x", &tm);
- assert(!strcmp(timebuf, "03/08/21"));
-
- memset(timebuf, 0, sizeof(timebuf));
- strftime(timebuf, sizeof(timebuf), "%X", &tm);
- assert(!strcmp(timebuf, "17:17:00"));
-
- memset(timebuf, 0, sizeof(timebuf));
- strftime(timebuf, sizeof(timebuf), "%a %A", &tm);
- assert(!strcmp(timebuf, "Tue Tuesday"));
-
- memset(timebuf, 0, sizeof(timebuf));
- strftime(timebuf, sizeof(timebuf), "%b %B %h", &tm);
- assert(!strcmp(timebuf, "Mar March Mar"));
-
- memset(timebuf, 0, sizeof(timebuf));
- assert(!strftime(timebuf, sizeof(timebuf), "%a %A %a %A %b %B %h", &tm));
-
- return 0;
-}