From 9951ad78c80e144c166a7d476cad7ffdf84332a9 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Wed, 13 Aug 2014 14:55:49 -0700 Subject: Debug debugging --- src/strings/zstring.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/strings/zstring.py') 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}'), + ] -- cgit v1.2.3-70-g09d2