Ejemplo n.º 1
0
 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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
 def testMethodWithoutParamers(self):
     '''Method without parameters: Time.somethingCompletelyDifferent()'''
     time = Time()
     result = time.somethingCompletelyDifferent()
     self.assertEqual(result, Time.ZeroArgs)
Ejemplo n.º 5
0
 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')
Ejemplo n.º 6
0
 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')
Ejemplo n.º 7
0
 def testSimpleMethodWithoutParamers(self):
     '''Constructor without parameters: Time.setTime()'''
     time = Time(1, 2, 3, 4)
     time.setTime()
     self.assertTrue(time.isNull())
Ejemplo n.º 8
0
 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')
Ejemplo n.º 9
0
 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')
Ejemplo n.º 10
0
 def testConstructorWithoutParamers(self):
     '''Constructor without parameters: Time()'''
     time = Time()
     self.assertTrue(time.isNull())
Ejemplo n.º 11
0
 def testNotEqual(self):
     time = Time(12, 32, 6)
     py = datetime.time(12, 32, 5)
     self.assertNotEqual(time, py)
Ejemplo n.º 12
0
 def testCompareWithPythonTime(self):
     time = Time(12, 32, 5)
     py = datetime.time(12, 32, 5)
     self.assertEqual(time, py)
Ejemplo n.º 13
0
 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)
Ejemplo n.º 14
0
 def testMethodWithTwoParamers(self):
     '''Method with 2 parameters: Time.somethingCompletelyDifferent(...)'''
     time = Time()
     result = time.somethingCompletelyDifferent(1, 2)
     self.assertEqual(result, Time.TwoArgs)
Ejemplo n.º 15
0
 def testMethodWithThreeParamers(self):
     '''Method with 3 parameters: Time.somethingCompletelyDifferent(...)'''
     time = Time()
     result = time.somethingCompletelyDifferent(1, 2, ImplicitConv(ImplicitConv.CtorOne))
     self.assertEqual(result, Time.ThreeArgs)