MCPcopy Create free account
hub / github.com/cpmech/plotpy / draw_cylinder_fails_on_wrong_input

Function draw_cylinder_fails_on_wrong_input

src/surface_geometry.rs:430–446  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

428
429 #[test]
430 fn draw_cylinder_fails_on_wrong_input() {
431 let mut surf = Surface::new();
432 let res = surf.draw_cylinder(&[0.0, 0.0], &[1.0, 1.0, 1.0], 1.0, 1, 3);
433 assert_eq!(res.err(), Some("a.len() must equal to 3"));
434
435 let res = surf.draw_cylinder(&[0.0, 0.0, 0.0], &[1.0, 1.0], 1.0, 1, 3);
436 assert_eq!(res.err(), Some("b.len() must equal to 3"));
437
438 let res = surf.draw_cylinder(&[0.0, 0.0, 0.0], &[1.0, 1.0, 1.0], 1.0, 0, 3);
439 assert_eq!(res.err(), Some("ndiv_axis must be ≥ 1"));
440
441 let res = surf.draw_cylinder(&[0.0, 0.0, 0.0], &[1.0, 1.0, 1.0], 1.0, 1, 2);
442 assert_eq!(res.err(), Some("ndiv_perimeter must be ≥ 3"));
443
444 let res = surf.draw_cylinder(&[0.0, 0.0, 0.0], &[0.0, 0.0, 0.0], 1.0, 1, 3);
445 assert_eq!(res.err(), Some("a-to-b segment is too short"));
446 }
447
448 #[test]
449 fn draw_cylinder_works() {

Callers

nothing calls this directly

Calls 1

draw_cylinderMethod · 0.80

Tested by

no test coverage detected