' Gambas test file

''Bug 2884

Public Sub BugSingleToInt()

    Dim weight As Single = 0.07
    Dim maxweight As Single = 30

    Test.Plan(2)

    Assert.Equals(Int(weight / maxweight), 0)
    Assert.Equals(Int(weight / maxweight) + 1, 1)

End

'' Bug 2921 "Postgresql 19.900000000000055 is 20 in Gambas"
''
'' "It's a bug in the Gambas string to floating point conversion routine."

Public Sub BugStringToFloatConversion()

    Dim f As Float

    Test.Plan(4)

    f = 19.900000000000055
    Assert.Equals(f, 19.9000000000001)
    Assert.Approximate(Round(f, -2), 19.9, 1E-14)

    f = 19.9000000000001
    Assert.Equals(f, 19.9000000000001)
    Assert.Approximate(Round(f, -2), 19.9, 1E-14)

End
