summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.cpp')
-rw-r--r--src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.cpp
new file mode 100644
index 0000000..8fbd3f8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swscanf/test2/test2.cpp
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test2.c
+**
+** Purpose: Test to see if swscanf handles whitespace correctly
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swscanf.h"
+
+/*
+ * Tests out how it handles whitespace. Seems to accept anything that qualifies
+ * as isspace (space, tab, vertical tab, line feed, carriage return and form
+ * feed), even if it says it only wants spaces tabs and newlines.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoStrTest(convert("foo bar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo\tbar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo\nbar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo\rbar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo\vbar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo\fbar"), convert("foo %S"), "bar");
+ DoStrTest(convert("foo \t\n\r\v\fbar"), convert("foo %S"), "bar");
+
+ PAL_Terminate();
+ return PASS;
+}