From 9725d3418af87be960cba46f1c957b24e9d69550 Mon Sep 17 00:00:00 2001
From: oddcoder <ahmedsoliman@oddcoder.com>
Date: Sun, 26 Apr 2020 12:33:51 +0200
Subject: [PATCH] Test towlower and towupper

---
 tests/Makefile                        |  4 +++-
 tests/expected/wctype/towlower.stderr |  0
 tests/expected/wctype/towlower.stdout |  2 ++
 tests/expected/wctype/towupper.stderr |  0
 tests/expected/wctype/towupper.stdout |  2 ++
 tests/wctype/towlower.c               | 12 ++++++++++++
 tests/wctype/towupper.c               | 12 ++++++++++++
 7 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 tests/expected/wctype/towlower.stderr
 create mode 100644 tests/expected/wctype/towlower.stdout
 create mode 100644 tests/expected/wctype/towupper.stderr
 create mode 100644 tests/expected/wctype/towupper.stdout
 create mode 100644 tests/wctype/towlower.c
 create mode 100644 tests/wctype/towupper.c

diff --git a/tests/Makefile b/tests/Makefile
index 716600fa..6b056b4d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -103,7 +103,9 @@ EXPECT_NAMES=\
 	wchar/wcsstr \
 	wchar/wcstod \
 	wchar/wcstok \
-	wchar/wcstol
+	wchar/wcstol \
+	wctype/towlower \
+	wctype/towupper
 	# TODO: Fix these
 	# mkfifo
 
diff --git a/tests/expected/wctype/towlower.stderr b/tests/expected/wctype/towlower.stderr
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/expected/wctype/towlower.stdout b/tests/expected/wctype/towlower.stdout
new file mode 100644
index 00000000..fdbf1783
--- /dev/null
+++ b/tests/expected/wctype/towlower.stdout
@@ -0,0 +1,2 @@
+HaLf WiDe ChAr StRiNg!
+half wide char string!
diff --git a/tests/expected/wctype/towupper.stderr b/tests/expected/wctype/towupper.stderr
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/expected/wctype/towupper.stdout b/tests/expected/wctype/towupper.stdout
new file mode 100644
index 00000000..a09771e7
--- /dev/null
+++ b/tests/expected/wctype/towupper.stdout
@@ -0,0 +1,2 @@
+HaLf WiDe ChAr StRiNg!
+HALF WIDE CHAR STRING!
diff --git a/tests/wctype/towlower.c b/tests/wctype/towlower.c
new file mode 100644
index 00000000..a99d4252
--- /dev/null
+++ b/tests/wctype/towlower.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <wchar.h>
+#include <wctype.h>
+
+int main() {
+    wchar_t *str = L"HaLf WiDe ChAr StRiNg!\n";
+    fputws(str, stdout);
+    for (int i = 0; i < wcslen(str); i++) {
+        putwchar(towlower(str[i]));
+    }
+    return 0;
+}
\ No newline at end of file
diff --git a/tests/wctype/towupper.c b/tests/wctype/towupper.c
new file mode 100644
index 00000000..61fb09ed
--- /dev/null
+++ b/tests/wctype/towupper.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <wchar.h>
+#include <wctype.h>
+
+int main() {
+    wchar_t *str = L"HaLf WiDe ChAr StRiNg!\n";
+    fputws(str, stdout);
+    for (int i = 0; i < wcslen(str); i++) {
+        putwchar(towupper(str[i]));
+    }
+    return 0;
+}
\ No newline at end of file
-- 
GitLab