Skip to content

Commit

Permalink
Merge pull request JuliaLang#34 from andrej-makarov-skrt/ex-gigasecond
Browse files Browse the repository at this point in the history
Add exercise: gigasecond
  • Loading branch information
SaschaMann authored Feb 7, 2017
2 parents 56a5dc2 + 0ac76c7 commit 7ba73f2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
"exceptions"
]
},
{
"slug": "gigasecond",
"difficulty": 1,
"topics": [
"dates"
]
},
{
"slug": "difference-of-squares",
"difficulty": 1,
Expand Down
1 change: 1 addition & 0 deletions exercises/gigasecond/example.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_gigasecond(date::DateTime) = date + Dates.Second(10^9)
3 changes: 3 additions & 0 deletions exercises/gigasecond/gigasecond.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function add_gigasecond(date::DateTime)

end
15 changes: 15 additions & 0 deletions exercises/gigasecond/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Base.Test

include("gigasecond.jl")

samples = Dict(
DateTime("2011-04-25") => DateTime("2043-01-01T01:46:40"),
DateTime("1977-06-13") => DateTime("2009-02-19T01:46:40"),
DateTime("1959-07-19") => DateTime("1991-03-27T01:46:40"),
DateTime("2015-01-24T22:00:00") => DateTime("2046-10-02T23:46:40"),
DateTime("2015-01-24T23:59:59") => DateTime("2046-10-03T01:46:39")
)

@testset "add gigasecond to $sample[1]" for sample in samples
@test add_gigasecond(sample[1]) == sample[2]
end

0 comments on commit 7ba73f2

Please sign in to comment.