Skip to content

Commit

Permalink
Merge pull request #16915 from JuliaLang/ksh/misc
Browse files Browse the repository at this point in the history
A few small miscellaneous tests
  • Loading branch information
vtjnash authored Jun 14, 2016
2 parents 404da70 + ec680f6 commit 2efec16
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/char.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ let
#size(c::Char) = ()
for x in testarrays
@test size(x) == ()
@test_throws BoundsError size(x,0)
@test size(x,1) == 1
end

#ndims(c::Char) = 0
Expand Down
1 change: 1 addition & 0 deletions test/dates/accessors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function test_dates1()
@test d == Dates.dayofmonth(dt)
@test h == Dates.hour(dt)
@test mi == Dates.minute(dt)
@test (m,d) == Dates.monthday(dt)
#@test s == Dates.second(dt)
#@test ms == Dates.millisecond(dt)
end
Expand Down
2 changes: 2 additions & 0 deletions test/dates/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Test string/show representation of Date
@test string(Dates.Date(1,1,1)) == "0001-01-01" # January 1st, 1 AD/CE
@test sprint(show, Dates.Date(1,1,1)) == "0001-01-01"
@test string(Dates.Date(0,12,31)) == "0000-12-31" # December 31, 1 BC/BCE
@test Dates.Date(1,1,1) - Dates.Date(0,12,31) == Dates.Day(1)
@test Dates.Date(Dates.UTD(-306)) == Dates.Date(0,2,29)
Expand All @@ -10,6 +11,7 @@
@test string(Dates.Date(-1000000,1,1)) == "-1000000-01-01"
@test string(Dates.Date(1000000,1,1)) == "1000000-01-01"
@test string(Dates.DateTime(2000,1,1,0,0,0,1)) == "2000-01-01T00:00:00.001"
@test sprint(show,Dates.DateTime(2000,1,1,0,0,0,1)) == "2000-01-01T00:00:00.001"
@test string(Dates.DateTime(2000,1,1,0,0,0,2)) == "2000-01-01T00:00:00.002"
@test string(Dates.DateTime(2000,1,1,0,0,0,500)) == "2000-01-01T00:00:00.5"
@test string(Dates.DateTime(2000,1,1,0,0,0,998)) == "2000-01-01T00:00:00.998"
Expand Down
2 changes: 2 additions & 0 deletions test/dates/query.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ daysofweek = [Dates.Tue,Dates.Sat,Dates.Sun,Dates.Thu,Dates.Sun,Dates.Fri,
Dates.Sun,Dates.Thu,Dates.Mon,Dates.Thu,Dates.Mon,Dates.Wed]
dows = ["Tuesday","Saturday","Sunday","Thursday","Sunday","Friday",
"Sunday","Thursday","Monday","Thursday","Monday","Wednesday"]
daysinmonth = [31,28,31,30,31,30,31,31,30,31,30,31]
for (i,dt) in enumerate([jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec])
@test Dates.month(dt) == i
@test Dates.monthname(dt) == monthnames[i]
Expand All @@ -31,6 +32,7 @@ for (i,dt) in enumerate([jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec])
@test Dates.dayname(Dates.dayofweek(dt)) == dows[i]
@test Dates.dayabbr(dt) == dows[i][1:3]
@test Dates.dayabbr(Dates.dayofweek(dt)) == dows[i][1:3]
@test Dates.daysinmonth(dt) == daysinmonth[i]
end

# Customizing locale
Expand Down
3 changes: 3 additions & 0 deletions test/dates/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,6 @@ ms = Dates.Millisecond(1)
@test Dates.Date(d,y) == Dates.Date(1,1,1)
@test Dates.Date(d,m) == Dates.Date(1,1,1)
@test Dates.Date(m,y) == Dates.Date(1,1,1)

@test isfinite(Dates.Date)
@test isfinite(Dates.DateTime)

0 comments on commit 2efec16

Please sign in to comment.