Commit 4497613f authored by SND\kernelnet_cp's avatar SND\kernelnet_cp
Browse files

[test] added : testArrayField ( typed with array fields )

git-svn-id: https://pykd.svn.codeplex.com/svn@69294 9b283d60-5439-405e-af05-b73fd8c4d996
parent 8e3cadb0
......@@ -17,9 +17,9 @@ class TypeInfoTest( unittest.TestCase ):
def testSimpleStruct(self):
ti = pykd.typeInfo( target.moduleName, "Type1" )
self.assertEqual( hasattr( ti, "field1" ), True )
self.assertEqual( hasattr( ti, "field2" ), True )
self.assertEqual( hasattr( ti, "field3" ), True )
self.assertTrue( hasattr( ti, "field1" ) )
self.assertTrue( hasattr( ti, "field2" ) )
self.assertTrue( hasattr( ti, "field3" ) )
tv = pykd.typedVar( ti, target.module.var1 )
self.assertEqual( tv.field1, -121 )
......@@ -53,4 +53,19 @@ class TypeInfoTest( unittest.TestCase ):
self.assertTrue( hasattr( ti4, "field4" ) )
self.assertTrue( hasattr( ti4, "field4" ) )
self.assertTrue( hasattr( ti4.field4, "field41" ) )
def testPtrField(self):
v6 = pykd.typedVar( target.moduleName, "Type6", pykd.getOffset( target.moduleName, "var6" ) )
self.assertEqual( v6.field1, 10 )
self.assertEqual( v6.field2.field1, 10 )
self.assertEqual( v6.field2.field2, 20 )
self.assertNotEqual( v6.field2, 0 )
self.assertEqual( v6.field3[0].field1, 10 )
self.assertEqual( v6.field3[1].field2, 20 )
def testArrayField(self):
v7 = pykd.typedVar( target.moduleName, "Type7", pykd.getOffset( target.moduleName, "var7" ) )
self.assertEqual( v7.field1[1].field1, 10 )
self.assertEqual( v7.field1[5].field2, 20 )
self.assertEqual( v7.field2[1][0].field1, 10 )
self.assertEqual( v7.field2[0][1].field2, 20 )
......@@ -129,4 +129,59 @@ Type4 var4 = {};
#pragma pack( pop )
///////////////////////////////////////////////////////////////////////////////
class Type5 {
private:
int field1;
int field2;
public:
Type5() : field1(10), field2(20) {}
};
class Type6 {
private:
int field1;
Type5 *field2;
Type5 *field3[2];
public:
Type6() {
field1 = 10;
field2 = new Type5;
field3[0] = new Type5;
field3[1] = new Type5;
}
~Type6() {
delete field2;
}
};
Type6 var6;
///////////////////////////////////////////////////////////////////////////////
class Type7 {
private:
Type5 field1[10];
Type5 field2[2][2];
int field3[2][2][2];
};
Type7 var7;
///////////////////////////////////////////////////////////////////////////////
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment