aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnthony Thibault <ajt@hyperlogic.org>2013-05-03 21:17:04 -0700
committerAnthony Thibault <ajt@hyperlogic.org>2013-05-08 20:39:23 -0700
commita928ac77a8a9de8886e5f9842930c6976df77392 (patch)
tree3a491d2f4555569a84349fc8ca818db9c989fbaa /tests
parent5e86eb0a834d9da5128e9fe9a6e24f94ec1cf0c1 (diff)
Issue #1134: scanf does not treat CR, FF, VT as whitespace
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 27fb84dc..9d7cd121 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -6039,6 +6039,38 @@ Pass: 0.000012 0.000012''')
'''
self.do_run(src, '''0:173,16 1:16,173 2:183,173 3:17,287 4:98,123''')
+ def test_sscanf_other_whitespace(self):
+ src = r'''
+ #include<stdio.h>
+
+ int main() {
+ short int x;
+ short int y;
+
+ const char* buffer[] = {
+ "\t2\t3\t", /* TAB - horizontal tab */
+ "\t\t5\t\t7\t\t",
+ "\n11\n13\n", /* LF - line feed */
+ "\n\n17\n\n19\n\n",
+ "\v23\v29\v", /* VT - vertical tab */
+ "\v\v31\v\v37\v\v",
+ "\f41\f43\f", /* FF - form feed */
+ "\f\f47\f\f53\f\f",
+ "\r59\r61\r", /* CR - carrage return */
+ "\r\r67\r\r71\r\r"
+ };
+
+ for (int i=0; i<10; ++i) {
+ x = 0; y = 0;
+ sscanf(buffer[i], " %d %d ", &x, &y);
+ printf("%d, %d, ", x, y);
+ }
+
+ return 0;
+ }
+ '''
+ self.do_run(src, '''2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ''')
+
def test_sscanf_3(self):
# i64
if not Settings.USE_TYPED_ARRAYS == 2: return self.skip('64-bit sscanf only supported in ta2')