#![deny(warnings)]
extern crate rust_3d;
use rust_3d::prelude::*;
use rust_3d::io::*;
use rust_3d::test_helper::*;
static GENERATE_EXCEPTED_RESULT_FILES: bool = false;
#[test]
fn point_cloud_2d_io_test() {
{
let path_expected = "tests/data/expected_pc_2d_save1.csv";
let path_tmp = "tests/tmp/pc_2d_save1.tmp";
let mut pc = PointCloud2D::<Point2D>::new();
for i in 0..10 {
let p = Point2D::new(0.1 * i as f64, 0.2 * i as f64);
pc.push(p);
}
if GENERATE_EXCEPTED_RESULT_FILES {
save_xy(&pc, &path_expected, ";", "\n").unwrap();
}
save_xy(&pc, &path_tmp, ";", "\n").unwrap();
assert_files_equal(path_expected, path_tmp);
}
{
let mut pc = PointCloud2D::<Point2D>::new();
load_xy(&mut pc, "tests/data/test_square.xy", " ", "\n").unwrap();
assert!(pc.len() == 20 * 20);
}
}