Skip to content

Commit

Permalink
Improving infrastructure for future tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bourumir-wyngs committed May 26, 2024
1 parent 0a0834a commit 93738f6
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/tests/urdf_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,24 @@ fn test_extraction_kr6r700sixx() {
assert_eq!(urdf.c4, yaml.c4, "c4 parameter mismatch");
}

fn assert_parameter_extraction(yaml: Parameters, urdf: URDFParameters, robot: &str) {
assert_eq!(urdf.a1, yaml.a1, "a1 parameter mismatch for {}", robot);
assert_eq!(urdf.a2, yaml.a2, "a2 parameter mismatch for {}", robot);
assert_eq!(urdf.b, yaml.b, "b parameter mismatch for {}", robot);
assert_eq!(urdf.c1, yaml.c1, "c1 parameter mismatch for {}", robot);
assert_eq!(urdf.c2, yaml.c2, "c2 parameter mismatch for {}", robot);
assert_eq!(urdf.c3, yaml.c3, "c3 parameter mismatch for {}", robot);
assert_eq!(urdf.c4, yaml.c4, "c4 parameter mismatch for {}", robot);
}

#[test]
fn test_extraction_kr150() {
let yaml = Parameters::from_yaml_file("\
src/tests/data/kuka/opw_parameters_kr150r3100_2.yaml")
.expect("Failed to read or parse URDF");
let urdf = read_urdf("src/tests/data/kuka/kr150r3100_2_macro.xacro");

assert_eq!(urdf.a1, yaml.a1, "a1 parameter mismatch");
assert_eq!(urdf.a2, yaml.a2, "a2 parameter mismatch");
assert_eq!(urdf.b, yaml.b, "b parameter mismatch");
assert_eq!(urdf.c1, yaml.c1, "c1 parameter mismatch");
assert_eq!(urdf.c2, yaml.c2, "c2 parameter mismatch");
assert_eq!(urdf.c3, yaml.c3, "c3 parameter mismatch");
assert_eq!(urdf.c4, yaml.c4, "c4 parameter mismatch");
assert_parameter_extraction(yaml, urdf, "kr150r3100_2");
}

#[test]
Expand All @@ -154,13 +158,7 @@ fn test_extraction_kr10r1420() {
.expect("Failed to read or parse URDF");
let urdf = read_urdf("src/tests/data/kuka/kr10r1420_macro.xacro");

assert_eq!(urdf.a1, yaml.a1, "a1 parameter mismatch");
assert_eq!(urdf.a2, yaml.a2, "a2 parameter mismatch");
assert_eq!(urdf.b, yaml.b, "b parameter mismatch");
assert_eq!(urdf.c1, yaml.c1, "c1 parameter mismatch");
assert_eq!(urdf.c2, yaml.c2, "c2 parameter mismatch");
assert_eq!(urdf.c3, yaml.c3, "c3 parameter mismatch");
assert_eq!(urdf.c4, yaml.c4, "c4 parameter mismatch");
assert_parameter_extraction(yaml, urdf, "kr10r1420");
}


0 comments on commit 93738f6

Please sign in to comment.