[Lldb-commits] [lldb] r114764 - in /lldb/trunk/test: array_types/TestArrayTypes.py bitfields/TestBitfields.py

Johnny Chen johnny.chen at apple.com
Fri Sep 24 14:52:37 PDT 2010


Author: johnny
Date: Fri Sep 24 16:52:37 2010
New Revision: 114764

URL: http://llvm.org/viewvc/llvm-project?rev=114764&view=rev
Log:
Added comments about the usage of int(string, 0) and long(string, 0) which pass
a base of 0 so that the radix of the string is determined based on the contents
of string.

Modified:
    lldb/trunk/test/array_types/TestArrayTypes.py
    lldb/trunk/test/bitfields/TestBitfields.py

Modified: lldb/trunk/test/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/array_types/TestArrayTypes.py?rev=114764&r1=114763&r2=114764&view=diff
==============================================================================
--- lldb/trunk/test/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/array_types/TestArrayTypes.py Fri Sep 24 16:52:37 2010
@@ -148,6 +148,9 @@
                         "Variable 'char_16' should have 16 children")
 
         # Lookup the "ushort_matrix" ushort[] array variable.
+        # Notice the pattern of int(child0_2.GetValue(frame), 0).  We pass a
+        # base of 0 so that the proper radix is determined based on the contents
+        # of the string.  Same applies to long().
         variable = frame.LookupVar("ushort_matrix")
         self.DebugSBValue(frame, variable)
         self.assertTrue(variable.GetNumChildren() == 2,
@@ -158,7 +161,7 @@
                         "Variable 'ushort_matrix[0]' should have 3 children")
         child0_2 = child0.GetChildAtIndex(2)
         self.DebugSBValue(frame, child0_2)
-        self.assertTrue(int(child0_2.GetValue(frame), 16) == 3,
+        self.assertTrue(int(child0_2.GetValue(frame), 0) == 3,
                         "ushort_matrix[0][2] == 3")
 
         # Lookup the "long_6" char array variable.
@@ -168,7 +171,7 @@
                         "Variable 'long_6' should have 6 children")
         child5 = variable.GetChildAtIndex(5)
         self.DebugSBValue(frame, child5)
-        self.assertTrue(long(child5.GetValue(frame)) == 6,
+        self.assertTrue(long(child5.GetValue(frame), 0) == 6,
                         "long_6[5] == 6")
 
 

Modified: lldb/trunk/test/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/bitfields/TestBitfields.py?rev=114764&r1=114763&r2=114764&view=diff
==============================================================================
--- lldb/trunk/test/bitfields/TestBitfields.py (original)
+++ lldb/trunk/test/bitfields/TestBitfields.py Fri Sep 24 16:52:37 2010
@@ -108,6 +108,9 @@
                         bits.GetByteSize() == 4,
                         "(Bits)bits with byte size of 4 and 8 children")
 
+        # Notice the pattern of int(b1.GetValue(frame), 0).  We pass a base of 0
+        # so that the proper radix is determined based on the contents of the
+        # string.
         b1 = bits.GetChildAtIndex(0)
         self.DebugSBValue(frame, b1)
         self.assertTrue(b1.GetName() == "b1" and





More information about the lldb-commits mailing list