()
| 109 | |
| 110 | #[test] |
| 111 | fn test_barplot_4() -> Result<(), StrError> { |
| 112 | // data |
| 113 | let fruits = ["Apple", "Banana", "Orange"]; |
| 114 | let prices = [10.0, 20.0, 30.0]; |
| 115 | let errors = [3.0, 2.0, 1.0]; |
| 116 | |
| 117 | // barplot object and options |
| 118 | let mut bar = Barplot::new(); |
| 119 | bar.set_errors(&errors) |
| 120 | .set_horizontal(true) |
| 121 | .set_with_text("edge") |
| 122 | .draw_with_str(&fruits, &prices); |
| 123 | |
| 124 | // plot |
| 125 | let mut plot = Plot::new(); |
| 126 | plot.set_inv_y().add(&bar); |
| 127 | |
| 128 | // save figure |
| 129 | let path = Path::new(OUT_DIR).join("integ_barplot_4.svg"); |
| 130 | plot.set_title("Fruits").set_label_x("price").save(&path)?; |
| 131 | |
| 132 | // check number of lines |
| 133 | let file = File::open(path).map_err(|_| "cannot open file")?; |
| 134 | let buffered = BufReader::new(file); |
| 135 | let lines_iter = buffered.lines(); |
| 136 | let c = lines_iter.count(); |
| 137 | assert!(c > 770 && c < 810); |
| 138 | Ok(()) |
| 139 | } |
| 140 | |
| 141 | #[test] |
| 142 | fn test_barplot_5() -> Result<(), StrError> { |
nothing calls this directly
no test coverage detected