Added two new .cpp files to be tested via TestBasicTypes.py for correct display

of various combinations of data structures with unsigned int or unsigned long
builtin types.

llvm-svn: 114756
This commit is contained in:
Johnny Chen 2010-09-24 20:41:17 +00:00
parent 9d06adcf88
commit c01b78e7b2
4 changed files with 85 additions and 1 deletions

View File

@ -33,6 +33,20 @@ class BasicTypesTestCase(TestBase):
self.setTearDownCleanup(dictionary=d)
self.int_type()
def test_unsigned_int_type_with_dsym(self):
"""Test that 'unsigned_int'-type variables are displayed correctly."""
d = {'CXX_SOURCES': 'unsigned_int.cpp'}
self.buildDsym(dictionary=d)
self.setTearDownCleanup(dictionary=d)
self.unsigned_int_type()
def test_unsigned_int_type_with_dwarf(self):
"""Test that 'unsigned int'-type variables are displayed correctly."""
d = {'CXX_SOURCES': 'unsigned_int.cpp'}
self.buildDwarf(dictionary=d)
self.setTearDownCleanup(dictionary=d)
self.unsigned_int_type()
def test_long_type_with_dsym(self):
"""Test that long-type variables are displayed correctly."""
d = {'CXX_SOURCES': 'long.cpp'}
@ -47,14 +61,36 @@ class BasicTypesTestCase(TestBase):
self.setTearDownCleanup(dictionary=d)
self.long_type()
def test_unsigned_long_type_with_dsym(self):
"""Test that 'unsigned long'-type variables are displayed correctly."""
d = {'CXX_SOURCES': 'unsigned_long.cpp'}
self.buildDsym(dictionary=d)
self.setTearDownCleanup(dictionary=d)
self.unsigned_long_type()
def test_unsigned_long_type_with_dwarf(self):
"""Test that 'unsigned long'-type variables are displayed correctly."""
d = {'CXX_SOURCES': 'unsigned_long.cpp'}
self.buildDwarf(dictionary=d)
self.setTearDownCleanup(dictionary=d)
self.unsigned_long_type()
def int_type(self):
"""Test that int-type variables are displayed correctly."""
self.generic_type_tester("int")
def unsigned_int_type(self):
"""Test that 'unsigned int'-type variables are displayed correctly."""
self.generic_type_tester("unsigned int")
def long_type(self):
"""Test that long-type variables are displayed correctly."""
self.generic_type_tester("long")
def unsigned_long_type(self):
"""Test that 'unsigned long'-type variables are displayed correctly."""
self.generic_type_tester("unsigned long")
def generic_type_tester(self, type):
"""Test that variables with basic types are displayed correctly."""
@ -106,8 +142,20 @@ class BasicTypesTestCase(TestBase):
for var, val in gl:
self.runCmd("frame variable %s" % var)
output = self.res.GetOutput()
# Extract the display type and canonicalize its atoms into a set.
# Same for the input type string.
dt = re.match("^\((.*)\)", output).group(1)
ds = set(dt.split())
ts = set(type.split())
# The display type set must be a superset of the input type set.
if not ds.issuperset(ts):
self.fail("The display type: %s must match the input type: %s" %
(dt, type))
# The (var, val) pair must match, too.
self.expect(output, Msg(var, val), exe=False,
patterns = ["\(%s.*\)" % type],
substrs = [" %s = %s" % (var, val)])

View File

@ -1,9 +1,18 @@
#define T long
#define T_CSTR "long"
#ifdef __LP64__
#define T_VALUE_1 110011101111
#define T_VALUE_2 220022202222
#define T_VALUE_3 330033303333
#define T_VALUE_4 440044404444
#else
#define T_VALUE_1 110011101
#define T_VALUE_2 220022202
#define T_VALUE_3 330033303
#define T_VALUE_4 440044404
#endif
#define T_PRINTF_FORMAT "%ld"
#include "basic_type.cpp"

View File

@ -0,0 +1,9 @@
#define T unsigned int
#define T_CSTR "unsigned int"
#define T_VALUE_1 11001110
#define T_VALUE_2 22002220
#define T_VALUE_3 33003330
#define T_VALUE_4 44004440
#define T_PRINTF_FORMAT "%u"
#include "basic_type.cpp"

View File

@ -0,0 +1,18 @@
#define T unsigned long
#define T_CSTR "unsigned long"
#ifdef __LP64__
#define T_VALUE_1 110011101111
#define T_VALUE_2 220022202222
#define T_VALUE_3 330033303333
#define T_VALUE_4 440044404444
#else
#define T_VALUE_1 110011101
#define T_VALUE_2 220022202
#define T_VALUE_3 330033303
#define T_VALUE_4 440044404
#endif
#define T_PRINTF_FORMAT "%ld"
#include "basic_type.cpp"