Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/program_options/test/winmain.py @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

  • Property svn:executable set to *
File size: 721 bytes
Line 
1
2from StringIO import StringIO
3import string
4
5testcases = r"""1 -> 1
61"2" -> 12
71"2  -> 12
81"\"2" -> 1"2
9"1" "2" -> 1, 2
101\" -> 1"
111\\" -> 1\ 
121\\\" -> 1\" 
131\\\\" -> 1\\ 
141" 1 -> 1 1
151\" 1 -> 1", 1
161\1 -> 1\1
171\\1 -> 1\\1
18"""
19
20#testcases = r"""1\\\\" -> 1\\
21#"""
22
23t = StringIO(testcases)
24
25def quote(s):
26    result = s.replace("\\", r"\\")
27    result = result.replace("\"", "\\\"")
28    return '"' + result + '"'
29
30
31for s in t:
32    s = string.strip(s)
33    (value, result) = string.split(s, "->")
34#    print value, result
35    tokens = string.split(result, ",")
36    value = quote(value)
37    tokens = map(string.strip, tokens)
38    tokens = map(quote, tokens)
39    print "TEST(%s, {%s});" % (value, string.join(tokens, ","))
Note: See TracBrowser for help on using the repository browser.