Skip to content

Commit

Permalink
Fix tests for Dates
Browse files Browse the repository at this point in the history
  • Loading branch information
sostock committed Jun 20, 2019
1 parent f3775de commit a0821f4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions stdlib/Dates/test/ranges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ using Dates

using InteractiveUtils: subtypes

# Compare ranges by comparing their `first` and `last` elements and their `length`. This
# returns `false` if empty ranges have different startpoints.
==(r::AbstractRange, s::AbstractRange) =
(first(r) == first(s)) & (length(r) == length(s)) & (last(r) == last(s))

let
for T in (Dates.Date, Dates.DateTime)
f1 = T(2014); l1 = T(2013, 12, 31)
Expand Down Expand Up @@ -35,7 +40,7 @@ let
@test first(reverse(dr)) < f1
@test last(reverse(dr)) >= f1
@test issorted(dr)
@test sortperm(dr) === Int64(1):Int64(1):Int64(0)
@test sortperm(dr) ==1:1:0
@test !(f1 in dr)
@test !(l1 in dr)
@test !(f1 - pos_step in dr)
Expand Down Expand Up @@ -93,7 +98,7 @@ let
@test first(reverse(dr)) > l1
@test last(reverse(dr)) <= l1
@test issorted(dr)
@test sortperm(dr) === Int64(1):Int64(1):Int64(0)
@test sortperm(dr) ==1:1:0
@test !(l1 in dr)
@test !(l1 in dr)
@test !(l1 - neg_step in dr)
Expand Down Expand Up @@ -153,7 +158,7 @@ let
@test first(reverse(dr)) < f1
@test last(reverse(dr)) >= f1
@test issorted(dr)
@test sortperm(dr) === Int64(1):Int64(1):Int64(0)
@test sortperm(dr) ==1:1:0
@test !(f1 in dr)
@test !(l1 in dr)
@test !(f1 - pos_step in dr)
Expand Down Expand Up @@ -211,7 +216,7 @@ let
@test first(reverse(dr)) > l1
@test last(reverse(dr)) <= l1
@test issorted(dr)
@test sortperm(dr) === Int64(1):Int64(1):Int64(0)
@test sortperm(dr) ==1:1:0
@test !(l1 in dr)
@test !(l1 in dr)
@test !(l1 - neg_step in dr)
Expand Down

0 comments on commit a0821f4

Please sign in to comment.