def testPassValueType(self): val = Val(123) val1 = val.passValueType(val) self.assertNotEqual(val, val1) self.assertEqual(val1.valId(), 123) val2 = val.callPassValueType(val) self.assertNotEqual(val, val2) self.assertEqual(val2.valId(), 123)
def testSumValListFromExtendedClass(self): lu = ExtListUser() lst = [Val(i) for i in range(4)] self.assertEqual(lu.sumValList(lst), sum([val.valId() for val in lst]) * 2) self.assertEqual(lu.callSumValList(lst), sum([val.valId() for val in lst]) * 2)
def testPassAndReceiveEnumValue(self): val = Val(0) self.assertEqual(val.oneOrTheOtherEnumValue(Val.One), Val.Other) self.assertEqual(val.oneOrTheOtherEnumValue(Val.Other), Val.One)
def testPassValueTypeReference(self): val = Val(0) self.assertEqual(val, val.passValueTypeReference(val)) self.assertEqual(val, val.callPassValueTypeReference(val))
def testPassValueTypePointer(self): val = Val(0) self.assertEqual(val, val.passValueTypePointer(val)) self.assertEqual(val, val.callPassValueTypePointer(val))
def testNormalMethod(self): valId = 123 val = Val(valId) self.assertEqual(val.valId(), valId)
def __init__(self, valId): Val.__init__(self, valId)
def createValList(self, num): return [Val(i) for i in range(0, num * 2, 2)]
def testSumValList(self): lu = ListUser() lst = [Val(i) for i in range(4)] self.assertEqual(lu.sumValList(lst), sum([val.valId() for val in lst])) self.assertEqual(lu.callSumValList(lst), sum([val.valId() for val in lst]))