diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2010-06-02 20:53:17 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2010-06-02 20:53:17 +0000 |
commit | 2824b0cbb66e715490e1ef13250bd675d87b32d9 (patch) | |
tree | c3bc8d54c6d73f2b7ce08cac34172dbc9f5e5b95 /trunk/Examples/test-suite/python/li_std_set_runme.py | |
parent | 289cfef4b4766ff266f3b1bdda8ca3a952e5a047 (diff) | |
download | swig-2.0.0.tar.gz |
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/tags/rel-2.0.0@12089 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'trunk/Examples/test-suite/python/li_std_set_runme.py')
-rw-r--r-- | trunk/Examples/test-suite/python/li_std_set_runme.py | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/trunk/Examples/test-suite/python/li_std_set_runme.py b/trunk/Examples/test-suite/python/li_std_set_runme.py new file mode 100644 index 000000000..6d8963138 --- /dev/null +++ b/trunk/Examples/test-suite/python/li_std_set_runme.py @@ -0,0 +1,96 @@ +from li_std_set import * + +s = set_string() + +s.append("a") +s.append("b") +s.append("c") + +sum = "" +for i in s: + sum = sum + i + +if sum != "abc": + raise RuntimeError + +i = s.__iter__() +if i.next() != "a": + raise RuntimeError +if i.next() != "b": + raise RuntimeError +if i.next() != "c": + raise RuntimeError + + +b = s.begin() +e = s.end() +sum = "" +while (b != e): + sum = sum + b.next() +if sum != "abc": + raise RuntimeError + +b = s.rbegin() +e = s.rend() +sum = "" +while (b != e): + sum = sum + b.next() + +if sum != "cba": + raise RuntimeError + + + +si = set_int() + +si.append(1) +si.append(2) +si.append(3) +i = si.__iter__() + +if i.next() != 1: + raise RuntimeError +if i.next() != 2: + raise RuntimeError +if i.next() != 3: + raise RuntimeError + + + + +i = s.begin() +i.next() +s.erase(i) + +b = s.begin() +e = s.end() +sum = "" +while (b != e): + sum = sum + b.next() +if sum != "ac": + raise RuntimeError + + +b = s.begin() +e = s.end() +if e - b != 2: + raise RuntimeError + +m = b + 1 +if m.value() != "c": + raise RuntimeError + + + +s = pyset() +s.insert((1,2)) +s.insert(1) +s.insert("hello") + + +sum = () +for i in s: + sum = sum + (i,) + +if sum != (1, 'hello', (1, 2)): + raise RuntimeError |