|
| 1 | +use pretty_assertions::assert_eq; |
| 2 | + |
| 3 | +use crate::{CommandExt, tool}; |
| 4 | + |
| 5 | +#[test] |
| 6 | +fn test_pack_four_squares() { |
| 7 | + let input = b"\ |
| 8 | + POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))\n\ |
| 9 | + POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))\n\ |
| 10 | + POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))\n\ |
| 11 | + POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))\n\ |
| 12 | + "; |
| 13 | + |
| 14 | + let expected = "\ |
| 15 | + POLYGON((-0.5 -0.5,-0.5 0.5,0.5 0.5,0.5 -0.5,-0.5 -0.5))\n\ |
| 16 | + POLYGON((1.5 -0.5,1.5 0.5,2.5 0.5,2.5 -0.5,1.5 -0.5))\n\ |
| 17 | + POLYGON((-0.5 1.5,-0.5 2.5,0.5 2.5,0.5 1.5,-0.5 1.5))\n\ |
| 18 | + POLYGON((1.5 1.5,1.5 2.5,2.5 2.5,2.5 1.5,1.5 1.5))\n\ |
| 19 | + "; |
| 20 | + |
| 21 | + let output = tool("pack") |
| 22 | + .arg("--width=4") |
| 23 | + .write_stdin(input) |
| 24 | + .captured_output(); |
| 25 | + assert!(output.status.success()); |
| 26 | + let stdout = String::from_utf8_lossy(&output.stdout); |
| 27 | + assert_eq!(expected, stdout); |
| 28 | +} |
0 commit comments