Skip to content

fix diff for 32bit arrays #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/TestSetExtensions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ function ExtendedTestSet(desc; wrap=DefaultTestSet)
ExtendedTestSet{wrap}(desc)
end

function isVector(e)
if e.head === :vect
return true
end
#Float32 or Int32 arrays get here as Ref's to Vector
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is not quite true. The arrays get here with the same syntax as a Ref, but they're not actually a ref to a vector. Just a bit of a confusing overlap in the display of vectors and the syntax for Refs.

if e.head === :ref && isa(e.args, Vector)
return true
end
return false
Comment on lines +65 to +68

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since e::Expr, we have isa(e.args, Vector) to always be true. So the following suffice

Suggested change
if e.head === :ref && isa(e.args, Vector)
return true
end
return false
return e.head === :ref

end

function Test.record(ts::ExtendedTestSet{T}, res::Fail) where {T}
if Distributed.myid() == 1
println("\n=====================================================")
Expand All @@ -69,11 +80,10 @@ function Test.record(ts::ExtendedTestSet{T}, res::Fail) where {T}
elseif isa(res.data, String)
Meta.parse(res.data)
end

if test_expr.head === :call && test_expr.args[1] === Symbol("==")
dd = if isa(test_expr.args[2], String) && isa(test_expr.args[3], String)
deepdiff(test_expr.args[2], test_expr.args[3])
elseif test_expr.args[2].head === :vect && test_expr.args[3].head === :vect
elseif isVector(test_expr.args[2]) && isVector(test_expr.args[3])
deepdiff(test_expr.args[2].args, test_expr.args[3].args)
elseif test_expr.args[2].head === :call && test_expr.args[3].head === :call &&
test_expr.args[2].args[1].head === :curly && test_expr.args[3].args[1].head === :curly
Expand Down