Example #1
0
def test_functions_for_zero():
    assert session3.float_equality_testing(
        0.0, 0.0), 'How can zero be not equal to zero?'
    assert session3.manual_truncation_function(
        0.0) == 0, 'Tuncation of 0 should be zero'
    assert session3.manual_rounding_function(
        0.0) == 0, 'Zero can only be rounded off to zero'
Example #2
0
def test_manual_truncation_function():
    for _ in range(100):
        f_num = random.uniform(-100, 100)
        assert session3.manual_truncation_function(f_num) == math.trunc(
            f_num
        ), 'Just because you are not able to fix this truncation error, SkyNet is going to rule the earth!'