'Check that int(x) has the correct value and type, for a float x.'

def check_conversion_to_int(self, x):

    n = int(x)
    if (x >= 0.0):
        self.assertLessEqual(n, x)
        self.assertLess(x, (n + 1))
    else:
        self.assertGreaterEqual(n, x)
        self.assertGreater(x, (n - 1))
    if (((- sys.maxint) - 1) <= n <= sys.maxint):
        self.assertEqual(type(n), int)
    else:
        self.assertEqual(type(n), long)
    self.assertEqual(type(int(n)), type(n))
