def testMethodWithAllParamers(self): '''Method with all parameters: Time.somethingCompletelyDifferent( int h, int m, ImplicitConv ic = ImplicitConv::CtorThree, ObjectType* type = 0 ); ''' time = Time() obj = ObjectType() result = time.somethingCompletelyDifferent(1, 2, ImplicitConv(2), obj) self.assertEqual(result, Time.FourArgs)
def testConversionOperator(self): '''Time defined an conversion operator for Str, so passing a Time object to a method expecting a Str should work.''' t = Time(1, 2, 3) t_str = t.toString() sl = StrList() # StrList.append expects a Str object. sl.append(t) self.assertEqual(len(sl), 1) self.assertEqual(sl[0], t_str)
def testMethodWithoutParamers(self): '''Method without parameters: Time.somethingCompletelyDifferent()''' time = Time() result = time.somethingCompletelyDifferent() self.assertEqual(result, Time.ZeroArgs)
def testSimpleMethodWithTwoParamers(self): '''Simple method with 2 parameters: Time.setTime(int h, int m, int s = 0, int ms = 0)''' time = Time() time.setTime(1, 2) self.assertTrue(time.toString(), '01:02:00.000')
def testSimpleMethodWithAllParamers(self): '''Simple method with all parameters: Time.setTime(int h, int m, int s = 0, int ms = 0)''' time = Time() time.setTime(1, 2, 3, 4) self.assertTrue(time.toString(), '01:02:03.004')
def testSimpleMethodWithoutParamers(self): '''Constructor without parameters: Time.setTime()''' time = Time(1, 2, 3, 4) time.setTime() self.assertTrue(time.isNull())
def testConstructorWithTwoParamers(self): '''Constructor with 2 parameters: Time(int h, int m, int s = 0, int ms = 0)''' time = Time(1, 2) self.assertTrue(time.toString(), '01:02:00.000')
def testConstructorWithAllParamers(self): '''Constructor with all parameters: Time(int h, int m, int s = 0, int ms = 0)''' time = Time(1, 2, 3, 4) self.assertTrue(time.toString(), '01:02:03.004')
def testConstructorWithoutParamers(self): '''Constructor without parameters: Time()''' time = Time() self.assertTrue(time.isNull())
def testNotEqual(self): time = Time(12, 32, 6) py = datetime.time(12, 32, 5) self.assertNotEqual(time, py)
def testCompareWithPythonTime(self): time = Time(12, 32, 5) py = datetime.time(12, 32, 5) self.assertEqual(time, py)
def testMethodWithThreeParamersAndImplicitConversion(self): '''Method with 3 parameters, the last one triggers an implicit conversion.''' time = Time() result = time.somethingCompletelyDifferent(1, 2, ImplicitConv.CtorOne) self.assertEqual(result, Time.ThreeArgs)
def testMethodWithTwoParamers(self): '''Method with 2 parameters: Time.somethingCompletelyDifferent(...)''' time = Time() result = time.somethingCompletelyDifferent(1, 2) self.assertEqual(result, Time.TwoArgs)
def testMethodWithThreeParamers(self): '''Method with 3 parameters: Time.somethingCompletelyDifferent(...)''' time = Time() result = time.somethingCompletelyDifferent(1, 2, ImplicitConv(ImplicitConv.CtorOne)) self.assertEqual(result, Time.ThreeArgs)