Skip to content

Commit

Permalink
Make tests work (many marked broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
oxinabox committed Jul 25, 2023
1 parent 8fc8c71 commit de65c8e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
10 changes: 10 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"

[extras]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
ChainRules = "1.44.6"
ChainRulesCore = "1.15.3"
Expand All @@ -27,3 +34,6 @@ StaticArrays = "1"
StatsBase = "0.33"
StructArrays = "0.6"
julia = "1.10"

[targets]
test = ["ForwardDiff", "LinearAlgebra", "Random", "Symbolics", "Test"]
18 changes: 13 additions & 5 deletions test/AbstractDifferentiationTests.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
using AbstractDifferentiation, Diffractor, Test
include(joinpath(pathof(AbstractDifferentiation), "..", "..", "test", "test_utils.jl"))
using AbstractDifferentiation, Diffractor, Test, LinearAlgebra
import AbstractDifferentiation as AD

backend = Diffractor.DiffractorForwardBackend()

@testset "basics" begin
@test AD.derivative(backend, +, 1.5, 10.0) == (1.0, 1.0)
@test AD.derivative(backend, *, 1.5, 10.0) == (10.0, 1.5)
@test only(AD.jacobian(backend, prod, [1.5, 2.5, 10.0])) == [25.0 15.0 3.75]
@test only(AD.jacobian(backend, identity, [1.5, 2.5, 10.0])) == Matrix(I, 3, 3)
end

# standard tests from AbstractDifferentiation.test_utils
include(joinpath(pathof(AbstractDifferentiation), "..", "..", "test", "test_utils.jl"))
@testset "ForwardDiffBackend" begin
backends = [
@inferred(Diffractor.DiffractorForwardBackend())
Expand Down Expand Up @@ -34,8 +42,8 @@ backend = Diffractor.DiffractorForwardBackend()
@testset "Lazy Gradient" begin #Diffractor.TangentBundle{1, Float64, Diffractor.TaylorTangent{Tuple{Float64}}}(::Float64, ::Tuple{Float64})
@test_broken test_lazy_gradients(backend)
end
@testset "Lazy Jacobian" begin
test_lazy_jacobians(backend; vaugmented=true)
@testset "Lazy Jacobian" begin #MethodError: no method matching *(::Diffractor.PrimeDerivativeBack{1, Diagonal{Bool, Vector{Bool}}}, ::Vector{Float64})
@test_broken test_lazy_jacobians(backend; vaugmented=true)
end
@testset "Lazy Hessian" begin # everything everywhere all at once is broken
@test_broken test_lazy_hessians(backend)
Expand Down
22 changes: 0 additions & 22 deletions test/Project.toml

This file was deleted.

0 comments on commit de65c8e

Please sign in to comment.