The following expect test fails with Unreachable crash when run with roc test, yet the same code works fine when run with roc:
expect {
is_approx_eq(0.999995.F64, 1.00005.F64)
}
is_approx_eq : F64, F64 -> Bool
is_approx_eq = |x1, x2| {
i1 = (x1 * 1000 + 0.5).to_u64_try() ?? { crash "Unreachable" }
i2 = (x2 * 1000 + 0.5).to_u64_try() ?? { crash "Unreachable" }
i1 == i2
}
main! = |_args| {
dbg is_approx_eq(0.999995.F64, 1.00005.F64)
Ok({})
}
The following
expecttest fails withUnreachablecrash when run withroc test, yet the same code works fine when run withroc: