From 27d8ce7296abc4b60063316de57f661777ae45c9 Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Fri, 13 Dec 2013 16:29:51 +0000 Subject: [PATCH] [0.2.x] added: test for issue #12591 ( typeBuilder generates a error alignment for array fields ) git-svn-id: https://pykd.svn.codeplex.com/svn@86824 9b283d60-5439-405e-af05-b73fd8c4d996 --- test/scripts/customtypestest.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/scripts/customtypestest.py b/test/scripts/customtypestest.py index bd702ed..41e162f 100644 --- a/test/scripts/customtypestest.py +++ b/test/scripts/customtypestest.py @@ -129,5 +129,20 @@ class CustomTypesTest(unittest.TestCase): mySubStruct.append( "m_uint2", tb.UInt2B ) mySubStructPtr = mySubStruct.ptrTo() self.assertEqual( pykd.ptrSize(), mySubStructPtr.size() ) - - + + def testAlign(self): + tb = pykd.typeBuilder() + struct = tb.createStruct(name ="MyAlignStruct", align=4) + struct.append( "m_field1", tb.UInt1B ) + self.assertEqual( 1, struct.size() ) + struct.append( "m_field2", tb.UInt1B ) + self.assertEqual( 2, struct.size() ) + struct.append( "m_field3", tb.UInt1B ) + struct.append( "m_field4", tb.UInt2B ) + self.assertEqual( 6, struct.size() ) + struct.append( "m_field5", tb.UInt4B ) + self.assertEqual( 12, struct.size() ) + struct.append( "m_field6", tb.UInt1B ) + self.assertEqual( 16, struct.size() ) + struct.append( "m_field7", tb.UInt1B.arrayOf(5) ) + self.assertEqual( 20, struct.size() )