Browse Source

Test towlower and towupper

oddcoder 4 years ago
parent
commit
9725d3418a

+ 3 - 1
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
 

+ 0 - 0
tests/expected/wctype/towlower.stderr


+ 2 - 0
tests/expected/wctype/towlower.stdout

@@ -0,0 +1,2 @@
+HaLf WiDe ChAr StRiNg!
+half wide char string!

+ 0 - 0
tests/expected/wctype/towupper.stderr


+ 2 - 0
tests/expected/wctype/towupper.stdout

@@ -0,0 +1,2 @@
+HaLf WiDe ChAr StRiNg!
+HALF WIDE CHAR STRING!

+ 12 - 0
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;
+}

+ 12 - 0
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;
+}