aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-16 10:50:24 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-16 10:50:24 -0700
commitc72022ee3788281dd764782eb51395e322efb1bc (patch)
tree24157bf239bf1c29cad368b7f3f6846cf6a7c5a1 /tests/test_core.py
parent147bc5e8b13ee6659b6a259a29400c53c537fb1c (diff)
parent80e69073322a40fe3b11c85d71b8bfa819aad5b4 (diff)
Merge pull request #1618 from sbalko/incoming
Incoming
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index dd3b7c44..a882ab59 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -6908,6 +6908,29 @@ at function.:blag
printf("%i\n", a);
}
+ char buf1[100], buf2[100], buf3[100], buf4[100];
+
+ int numItems = sscanf("level=4:ref=3", "%255[^:=]=%255[^:]:%255[^=]=%255c", buf1, buf2, buf3, buf4);
+ printf("%d, %s, %s, %s, %s\n", numItems, buf1, buf2, buf3, buf4);
+
+ numItems = sscanf("def|456", "%[a-z]|%[0-9]", buf1, buf2);
+ printf("%d, %s, %s\n", numItems, buf1, buf2);
+
+ numItems = sscanf("3-4,-ab", "%[-0-9],%[ab-z-]", buf1, buf2);
+ printf("%d, %s, %s\n", numItems, buf1, buf2);
+
+ numItems = sscanf("Hello,World", "%[A-Za-z],%[^0-9]", buf1, buf2);
+ printf("%d, %s, %s\n", numItems, buf1, buf2);
+
+ numItems = sscanf("Hello4711", "%[^0-9],%[^0-9]", buf1, buf2);
+ printf("%d, %s\n", numItems, buf1);
+
+ numItems = sscanf("JavaScript", "%4[A-Za-z]", buf1);
+ printf("%d, %s\n", numItems, buf1);
+
+ numItems = sscanf("[]", "%1[[]%1[]]", buf1, buf2);
+ printf("%d, %s, %s\n", numItems, buf1, buf2);
+
return 0;
}
'''
@@ -6915,7 +6938,14 @@ at function.:blag
'1\n1499\n' +
'5\n87,0.481565,0.059481,0,1\n' +
'3\n-123,4294966531,-34\n' +
- '1\n')
+ '1\n' +
+ '4, level, 4, ref, 3\n' +
+ '2, def, 456\n' +
+ '2, 3-4, -ab\n' +
+ '2, Hello, World\n' +
+ '1, Hello\n' +
+ '1, Java\n' +
+ '2, [, ]')
def test_sscanf_2(self):
# doubles