Skip to content

Commit

Permalink
add ForwardDiff dependency and setup safetestsets
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Oct 2, 2019
1 parent 41e5d3d commit 85cb9e5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
7 changes: 6 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ uuid = "be72d800-e507-11e9-3551-81be3d289e2a"
authors = ["Chris Rackauckas"]
version = "0.1.0"

[deps]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"

[compat]
ForwardDiff = "0.10"
julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"

[targets]
test = ["Test"]
test = ["Test","SafeTestsets"]
4 changes: 3 additions & 1 deletion src/MyExample.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module MyExample

using ForwardDiff

greet() = print("Hello World!")

include("extra_file.jl")

export my_f
export my_f, derivative_of_my_f

end # module
1 change: 1 addition & 0 deletions src/extra_file.jl
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
my_f(x,y) = 2x+3y
derivative_of_my_f(x,y) = ForwardDiff.derivative(x->my_f(x,y),x)
13 changes: 13 additions & 0 deletions test/my_f_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using MyExample
using Test

@testset "MyExample.jl" begin
# 2x + 3y
@test my_f(2,1) == 7
@test my_f(2,3) == 13
@test my_f(1,3) == 11
end

@testset "Derivative Tests" begin
@test derivative_of_my_f(2,1) == 2
end
11 changes: 2 additions & 9 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
using MyExample
using Test

@testset "MyExample.jl" begin
# 2x + 3y
@test my_f(2,1) == 7
@test my_f(2,3) == 13
@test my_f(1,3) == 11
end
using SafeTestsets
@safetestset "My f tests" begin include("my_f_tests.jl") end

0 comments on commit 85cb9e5

Please sign in to comment.