Skip to content

Commit

Permalink
Merge pull request #25820 from JuliaLang/ksh/iperr
Browse files Browse the repository at this point in the history
Tests for some IPstuff
  • Loading branch information
StefanKarpinski authored Feb 1, 2018
2 parents 0ee7817 + 2341bf1 commit c6f056b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/socket.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ using Random

@test_throws ArgumentError parse(IPv4, "192.0xFFFFFFFFF")
@test_throws ArgumentError parse(IPv4, "192.")
@test_throws ArgumentError parse(IPv4, "256.256.256.256")
# too many fields
@test_throws ArgumentError parse(IPv6, "256:256:256:256:256:256:256:256:256:256:256:256")

@test_throws ArgumentError IPv4(-1)
@test_throws ArgumentError IPv4(typemax(UInt32) + Int64(1))

@test ip"::1" == IPv6(1)
@test ip"2605:2700:0:3::4713:93e3" == IPv6(parse(UInt128,"260527000000000300000000471393e3", base = 16))
Expand All @@ -45,6 +51,11 @@ using Random

@test_throws ArgumentError IPv6(1,1,1,1,1,1,1,-1)
@test_throws ArgumentError IPv6(1,1,1,1,1,1,1,typemax(UInt16)+1)

@test IPv6(UInt16(1), UInt16(1), UInt16(1), UInt16(1), UInt16(1), UInt16(1), UInt16(1), UInt16(1)) == IPv6(1,1,1,1,1,1,1,1)

@test_throws BoundsError Base.ipv6_field(IPv6(0xffff7f000001), -1)
@test_throws BoundsError Base.ipv6_field(IPv6(0xffff7f000001), 9)
end

@testset "InetAddr constructor" begin
Expand Down

1 comment on commit c6f056b

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

Please sign in to comment.