()
| 78 | |
| 79 | #[test] |
| 80 | fn test_barplot_3() -> Result<(), StrError> { |
| 81 | // data |
| 82 | let fruits = [1.0, 2.0, 3.0]; |
| 83 | let prices = [10.0, 20.0, 30.0]; |
| 84 | let errors = [3.0, 2.0, 1.0]; |
| 85 | |
| 86 | // barplot object and options |
| 87 | let mut bar = Barplot::new(); |
| 88 | bar.set_errors(&errors) |
| 89 | .set_horizontal(true) |
| 90 | .set_with_text("edge") |
| 91 | .draw(&fruits, &prices); |
| 92 | |
| 93 | // plot |
| 94 | let mut plot = Plot::new(); |
| 95 | plot.set_inv_y().add(&bar); |
| 96 | |
| 97 | // save figure |
| 98 | let path = Path::new(OUT_DIR).join("integ_barplot_3.svg"); |
| 99 | plot.set_title("Fruits").set_label_x("price").save(&path)?; |
| 100 | |
| 101 | // check number of lines |
| 102 | let file = File::open(path).map_err(|_| "cannot open file")?; |
| 103 | let buffered = BufReader::new(file); |
| 104 | let lines_iter = buffered.lines(); |
| 105 | let c = lines_iter.count(); |
| 106 | assert!(c > 660 && c < 700); |
| 107 | Ok(()) |
| 108 | } |
| 109 | |
| 110 | #[test] |
| 111 | fn test_barplot_4() -> Result<(), StrError> { |
nothing calls this directly
no test coverage detected