def testReturnNan(self): """Test values for which log10(value) returns NaN. Test: NaN, -Inf, and a few negative values. """ testValues = (float('nan'), float('-inf'), -1.0, -sys.float_info.max, -sys.float_info.min) for value in testValues: logValue = ctools.fastLog10(value) self.assertTrue(math.isnan(logValue))
def testReturnDefined(self): """Test specific values.""" # Test cases as (value, log10(value)) testCases = ( (0.0, float('-inf')), (1.0, 0.0), (float('inf'), float('inf')), ) for value, refLogValue in testCases: logValue = ctools.fastLog10(value) self.assertEqual(logValue, refLogValue)
def testReturnNan(self): """Test values for which log10(value) returns NaN. Test: NaN, -Inf, and a few negative values. """ testValues = ( float('nan'), float('-inf'), -1.0, - sys.float_info.max, - sys.float_info.min ) for value in testValues: logValue = ctools.fastLog10(value) self.assertTrue(math.isnan(logValue))