summaryrefslogtreecommitdiff
path: root/src/strings/zstring.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings/zstring.py')
-rw-r--r--src/strings/zstring.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/strings/zstring.py b/src/strings/zstring.py
index dca5f4e..7f9ea2a 100644
--- a/src/strings/zstring.py
+++ b/src/strings/zstring.py
@@ -1,6 +1,4 @@
class ZString(object):
- ''' print a ZString
- '''
__slots__ = ('_value')
name = 'tmwa::strings::ZString'
enabled = True
@@ -8,11 +6,22 @@ class ZString(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::ZString(""_s)', '"" = {base = 0x0}'),
+ ('tmwa::ZString("Hello"_s)', '"Hello" = {base = 0x0}'),
+ ('tmwa::ZString("' + str256[:-2] + '"_s)', '"' + str256[:-2] + '" = {base = 0x0}'),
+ ('tmwa::ZString("' + str256[:-1] + '"_s)', '"' + str256[:-1] + '" = {base = 0x0}'),
+ ('tmwa::ZString("' + str256 + '"_s)', '"' + str256 + '" = {base = 0x0}'),
+ ('tmwa::ZString("' + str256 + 'x"_s)', '"' + str256 + 'x" = {base = 0x0}'),
+ ]