Revision c6b32510c32848d2476d0eb78548ee8d952bc8fe authored by Curtis Vogt on 20 February 2017, 14:09:32 UTC, committed by Tony Kelman on 20 February 2017, 14:09:32 UTC
* Use mbedTLS hostname verification for LibGit2

Corrects issues with hostname verification failing when the SSL subjectAltName is not
specified and the CN should be used.

* Add test for mbedTLS verification

* Made mbedTLS verification a seperate patch

* Disable startup-file

* Remove use of which

* Changes from PR review

* Use localhost when hostname isn't set to loopback

* Handle getaddrinfo exception

* Improve warning message

* Add libgit2-mbedtls-hostname.patch dependency

libgit2-mbedtls-hostname patch directly depends on the libgit2-mbedtls
patch. The libgit2-mbedtls-writer-fix patch also modifies the
mbedtls_stream.c file seperate section of the file. To ensure that the
patches are always applied in the same order we'll make the hostname
patch dependent on the writer-fix patch.
1 parent 9706c8b
Raw File
floatapprox.jl
# This file is a part of Julia. License is MIT: http://julialang.org/license

# Floating point numbers - basic tests
@test 4.00000000000001 ≈ 4.0
@test 5.0 ≈ 4.999999999999993
@test 4.000000002 ≉ 4.00300002

# Other tolerance levels
@test 4.32 ≈ 4.3 rtol=0.1 atol=0.01
@test 1.001 ≈ 1.002 rtol=0.001 atol=0.0001
@test 4.5 ≉ 4.9 rtol=0.001 atol=0.001

# Complex numbers
@test 1.0 + 1.0im ≈ 1.0 + 1.00000000000001im
@test 0.9999999999999 + 1.0im ≈ 1.0 + 1.000000000000001im
@test 0.9999 + 1.0im ≈ 1.0 + 1.1im rtol=0.0001 atol=1.1

# Complex <-> reals
@test 1.0 + 0im ≈ 1.0000000000001
@test 0.9999999999999 ≈ 1.0 + 0im
@test 1.0+1im ≉ 1.000000000000001

# Comparing NaNs
@test 4.0 ≉ NaN
@test NaN ≉ 4.0
@test complex(2.3,NaN) ≉ complex(NaN,2.3)
@test NaN ≉ NaN
@test complex(NaN,NaN) ≉ complex(NaN,NaN)
@test complex(NaN,2.3) ≉ complex(NaN,2.3)
@test complex(2.3,NaN) ≉ complex(2.3,NaN)

# Comparing Infs
@test Inf ≈ Inf
@test Inf ≉ 1
@test Inf ≉ -Inf
@test complex(0.0,Inf) ≈ complex(0.0,Inf)
@test complex(0.0,Inf) ≉ complex(0.0,-Inf)

# Tests for integers and rationals
@test 4 ≈ 4
@test 4 ≈ 5 atol=1
@test 4 ≉ 6 atol=1
@test 4 ≉ 5

@test 1//2+3im ≈ 1//2+3im
@test 1//3 ≈ 0.33333333333333333
@test 1//3 ≈ 0.3333 rtol=0.0001 atol=0.0001
@test 1+1im ≈ 1im+1

# Notably missing from this test suite at the moment
# * Tests for other magnitudes of numbers - very small, very big, and combinations of small and big
# * Tests for various odd combinations of types, e.g. x::Integer ≈ y::Rational

# issue #12375:
@test 1e17 ≉ 1

# Tests for arrays:
@test [1,2,3] ≈ [1,2,3+1e-9]
@test [0,1] ≈ [1e-9, 1]
@test [0,Inf] ≈ [0,Inf]
@test [0,Inf] ≉ [0,-Inf]

# issue #19936
for elty in (Float16,Float32,Float64)
    nan  = elty(NaN)
    half = elty(0.5)
    @test nan ≉ nan
    @test nan ≈ nan nans=true
    @test [half, nan, half] ≉ [half, nan, half]
    @test [half, nan, half] ≈ [half, nan, half] nans=true
end
back to top