Round floats in simulation tests to 3dp (#7211)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-05-26 11:17:12 +12:00
committed by GitHub
parent fa9d5a0104
commit 0c2785df67
186 changed files with 15397 additions and 15398 deletions

View File

@ -186,14 +186,14 @@ async fn execute_test(test: &Test, render_to_png: bool, export_step: bool) {
let mem_result = catch_unwind(AssertUnwindSafe(|| {
assert_snapshot(test, "Variables in memory after executing", || {
insta::assert_json_snapshot!("program_memory", outcome.variables, {
".**.value" => rounded_redaction(4),
".**[].value" => rounded_redaction(4),
".**.from[]" => rounded_redaction(4),
".**.to[]" => rounded_redaction(4),
".**.center[]" => rounded_redaction(4),
".**[].x[]" => rounded_redaction(4),
".**[].y[]" => rounded_redaction(4),
".**[].z[]" => rounded_redaction(4),
".**.value" => rounded_redaction(3),
".**[].value" => rounded_redaction(3),
".**.from[]" => rounded_redaction(3),
".**.to[]" => rounded_redaction(3),
".**.center[]" => rounded_redaction(3),
".**[].x[]" => rounded_redaction(3),
".**[].y[]" => rounded_redaction(3),
".**[].z[]" => rounded_redaction(3),
".**.sourceRange" => Vec::new(),
})
})
@ -281,11 +281,11 @@ fn assert_common_snapshots(
let result1 = catch_unwind(AssertUnwindSafe(|| {
assert_snapshot(test, "Operations executed", || {
insta::assert_json_snapshot!("ops", operations, {
"[].*.unlabeledArg.*.value.**[].from[]" => rounded_redaction(4),
"[].*.unlabeledArg.*.value.**[].to[]" => rounded_redaction(4),
"[].**.value.value" => rounded_redaction(4),
"[].*.labeledArgs.*.value.**[].from[]" => rounded_redaction(4),
"[].*.labeledArgs.*.value.**[].to[]" => rounded_redaction(4),
"[].*.unlabeledArg.*.value.**[].from[]" => rounded_redaction(3),
"[].*.unlabeledArg.*.value.**[].to[]" => rounded_redaction(3),
"[].**.value.value" => rounded_redaction(3),
"[].*.labeledArgs.*.value.**[].from[]" => rounded_redaction(3),
"[].*.labeledArgs.*.value.**[].to[]" => rounded_redaction(3),
".**.sourceRange" => Vec::new(),
".**.functionSourceRange" => Vec::new(),
".**.moduleId" => 0,
@ -295,10 +295,10 @@ fn assert_common_snapshots(
let result2 = catch_unwind(AssertUnwindSafe(|| {
assert_snapshot(test, "Artifact commands", || {
insta::assert_json_snapshot!("artifact_commands", artifact_commands, {
"[].command.**.value" => rounded_redaction(4),
"[].command.**.x" => rounded_redaction(4),
"[].command.**.y" => rounded_redaction(4),
"[].command.**.z" => rounded_redaction(4),
"[].command.**.value" => rounded_redaction(3),
"[].command.**.x" => rounded_redaction(3),
"[].command.**.y" => rounded_redaction(3),
"[].command.**.z" => rounded_redaction(3),
".**.range" => Vec::new(),
});
})