summaryrefslogtreecommitdiff
path: root/src/strings/xstring.py
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-08-13 14:55:49 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-08-27 11:29:45 -0700
commit9951ad78c80e144c166a7d476cad7ffdf84332a9 (patch)
tree9f5498a9a3c23b62dc928288e72081e99f958f46 /src/strings/xstring.py
parent749fec734c4583153fb2dbc80f1d21db2c2ab457 (diff)
downloadtmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.tar.gz
tmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.tar.bz2
tmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.tar.xz
tmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.zip
Debug debugging
Diffstat (limited to 'src/strings/xstring.py')
-rw-r--r--src/strings/xstring.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/strings/xstring.py b/src/strings/xstring.py
index fa0abcb..d289485 100644
--- a/src/strings/xstring.py
+++ b/src/strings/xstring.py
@@ -1,6 +1,4 @@
class XString(object):
- ''' print a XString
- '''
__slots__ = ('_value')
name = 'tmwa::strings::XString'
enabled = True
@@ -8,11 +6,22 @@ class XString(object):
def __init__(self, value):
self._value = value
- def children(self):
- yield 'base', self._value['_base']
-
def to_string(self):
b = self._value['_b']['_ptr']
e = self._value['_e']['_ptr']
d = e - b
return b.lazy_string(length=d)
+
+ def children(self):
+ yield 'base', self._value['_base']
+
+ str256 = '0123456789abcdef' * 16
+
+ tests = [
+ ('tmwa::XString(""_s)', '"" = {base = 0x0}'),
+ ('tmwa::XString("Hello"_s)', '"Hello" = {base = 0x0}'),
+ ('tmwa::XString("' + str256[:-2] + '"_s)', '"' + str256[:-2] + '" = {base = 0x0}'),
+ ('tmwa::XString("' + str256[:-1] + '"_s)', '"' + str256[:-1] + '" = {base = 0x0}'),
+ ('tmwa::XString("' + str256 + '"_s)', '"' + str256 + '" = {base = 0x0}'),
+ ('tmwa::XString("' + str256 + 'x"_s)', '"' + str256 + 'x" = {base = 0x0}'),
+ ]