forked from 1b-agent/opencadstudio-upstream
style: rustfmt the tree so the CI lint check passes
This commit is contained in:
1 parent
1317a7b4fd
commit
6025d8be44
128 files changed
+4097
-1676
No files matched your search
+24
-13
@@ -1161,9 +1161,7 @@ fn apply_updates(
|
||||
/// float would otherwise never match its `expected` value.
|
||||
fn json_values_match(actual: &Value, expected: &Value) -> bool {
|
||||
match (actual, expected) {
|
||||
(Value::Number(a), Value::Number(b)) if a.is_f64() || b.is_f64() => {
|
||||
numbers_match(a, b)
|
||||
}
|
||||
(Value::Number(a), Value::Number(b)) if a.is_f64() || b.is_f64() => numbers_match(a, b),
|
||||
(Value::Array(a), Value::Array(b)) => {
|
||||
a.len() == b.len() && a.iter().zip(b).all(|(a, b)| json_values_match(a, b))
|
||||
}
|
||||
@@ -1685,11 +1683,23 @@ mod tests {
|
||||
Value::Number(number) => number,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
assert!(super::numbers_match(&number(json!(10)), &number(json!(10.0))));
|
||||
assert!(!super::numbers_match(&number(json!(10)), &number(json!(10.5))));
|
||||
assert!(super::numbers_match(
|
||||
&number(json!(10)),
|
||||
&number(json!(10.0))
|
||||
));
|
||||
assert!(!super::numbers_match(
|
||||
&number(json!(10)),
|
||||
&number(json!(10.5))
|
||||
));
|
||||
let past_precision = number(json!(9_007_199_254_740_993_u64));
|
||||
assert!(!super::numbers_match(&past_precision, &number(json!(9_007_199_254_740_992.0))));
|
||||
assert!(super::numbers_match(&number(json!(-3)), &number(json!(-3.0))));
|
||||
assert!(!super::numbers_match(
|
||||
&past_precision,
|
||||
&number(json!(9_007_199_254_740_992.0))
|
||||
));
|
||||
assert!(super::numbers_match(
|
||||
&number(json!(-3)),
|
||||
&number(json!(-3.0))
|
||||
));
|
||||
}
|
||||
|
||||
fn execute(app: &mut OpenCADStudio, mut request: Value, id: &str) -> Value {
|
||||
@@ -1708,12 +1718,13 @@ mod tests {
|
||||
app.automation_op(r#"{"op":"new"}"#);
|
||||
let i = app.active_tab;
|
||||
|
||||
let handle = app.tabs[i].scene.add_entity(EntityType::Line(
|
||||
codec::entities::Line::from_points(
|
||||
Vector3::new(0.0, 0.0, 0.0),
|
||||
Vector3::new(10.0, 0.0, 0.0),
|
||||
),
|
||||
));
|
||||
let handle =
|
||||
app.tabs[i]
|
||||
.scene
|
||||
.add_entity(EntityType::Line(codec::entities::Line::from_points(
|
||||
Vector3::new(0.0, 0.0, 0.0),
|
||||
Vector3::new(10.0, 0.0, 0.0),
|
||||
)));
|
||||
// The designation is plugin-mutated scene state: mark through the
|
||||
// same host API a plugin uses, so the read surface reflects the
|
||||
// live set rather than any stored marker.
|
||||
|
||||
Reference in new issue
Block a user