正如@cstjean在https://github.com/JuliaLang/julia/pull/19880 中指出的那样, <strong i="7">@test</strong> a ≈ b
与<strong i="9">@test_approx_eq</strong> a b
不同之处在于前者不能很好地显示测试失败。 我们已经有专门的代码来很好地显示某些类型的比较,所以也许我们应该在那里有更多的逻辑来像@test_approx_eq
那样很好地显示近似相等失败。
@StefanKarpinski我想在这方面工作。 关于要做什么的更多信息?
julia> using Test
julia> <strong i="5">@test</strong> 2.1 ≈ 1+1
Test Failed at REPL[2]:1
Expression: 2.1 ≈ 1 + 1
Evaluated: 2.1 ≈ 2
ERROR: There was an error during testing
julia> <strong i="6">@test</strong> 2.1 == 1+1
Test Failed at REPL[3]:1
Expression: 2.1 == 1 + 1
Evaluated: 2.1 == 2
ERROR: There was an error during testing
看起来现在找到主人了吗?
最有用的评论
我相信这是由https://github.com/JuliaLang/julia/pull/30721解决的