Skip to content

Commit

Permalink
Add exercise: gigasecond
Browse files Browse the repository at this point in the history
  • Loading branch information
andrej-makarov-skrt committed Feb 7, 2017
1 parent c2125de commit 0ac76c7
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 @@ -22,6 +22,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 0ac76c7

Please sign in to comment.