Change KCL stdlib floating-point results to not be platform dependent (#7499)

* Add libm dependency

* Change to use libm for trig functions

* Remove redactions for floating point

* Update output

* Use clippy to prevent stdlib math sneaking back in

---------

Co-authored-by: Adam Chalmers <adam.chalmers@zoo.dev>
This commit is contained in:
Jonathan Tran
2025-06-16 21:34:50 -04:00
committed by GitHub
parent 1a4a030671
commit 7486d25cf1
433 changed files with 24677 additions and 24672 deletions

View File

@ -4,7 +4,6 @@ use std::{
};
use indexmap::IndexMap;
use insta::rounded_redaction;
use crate::{
errors::KclError,
@ -262,17 +261,6 @@ 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(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),
".**.x" => rounded_redaction(3),
".**.y" => rounded_redaction(3),
".**.z" => rounded_redaction(3),
".**.sourceRange" => Vec::new(),
})
})
@ -346,11 +334,6 @@ fn assert_artifact_snapshots(
let result1 = catch_unwind(AssertUnwindSafe(|| {
assert_snapshot(test, "Operations executed", || {
insta::assert_json_snapshot!("ops", module_operations, {
".*[].*.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,
@ -364,10 +347,6 @@ fn assert_artifact_snapshots(
let result2 = catch_unwind(AssertUnwindSafe(|| {
assert_snapshot(test, "Artifact commands", || {
insta::assert_json_snapshot!("artifact_commands", module_commands, {
".*[].command.**.value" => rounded_redaction(3),
".*[].command.**.x" => rounded_redaction(3),
".*[].command.**.y" => rounded_redaction(3),
".*[].command.**.z" => rounded_redaction(3),
".**.range" => Vec::new(),
});
})