Пример #1
0
    def test19_math_converters(self):
        """Test operator int/long/double incl. typedef"""

        from cppyy import gbl

        a = gbl.some_convertible()
        a.m_i = 1234
        a.m_d = 4321.

        assert int(a)  == 1234
        assert int(a)  == a.m_i
        assert long(a) == a.m_i

        assert float(a) == 4321.
        assert float(a) == a.m_d
Пример #2
0
    def test18_math_converters(self):
        """Test operator int/long/double incl. typedef"""

        from cppyy import gbl

        a = gbl.some_convertible()
        a.m_i = 1234
        a.m_d = 4321.

        assert int(a) == 1234
        assert int(a) == a.m_i
        assert pylong(a) == a.m_i

        assert float(a) == 4321.
        assert float(a) == a.m_d