fn test_print()

in src/data.rs [391:432]


    fn test_print() {
        let mut param = InitParams::new("".to_string());
        let data = CpuUtilizationRaw::new();
        let mut dt = DataType {
            data: Data::CpuUtilizationRaw(data),
            file_handle: None,
            file_name: "cpu_utilization".to_string(),
            full_path: String::new(),
            dir_name: String::new(),
            is_static: false,
            is_profile_option: false,
            collector_params: CollectorParams::new(),
        };

        param.dir_name = format!("./performance_data_print_test_{}", param.time_str);
        fs::DirBuilder::new()
            .recursive(true)
            .create(param.dir_name.clone())
            .unwrap();

        dt.init_data_type(&param).unwrap();

        assert!(Path::new(&dt.full_path).exists());
        dt.write_to_file().unwrap();

        loop {
            match bincode::deserialize_from::<_, Data>(dt.file_handle.as_ref().unwrap()) {
                Ok(v) => match v {
                    Data::CpuUtilizationRaw(ref value) => assert!(value.data.is_empty()),
                    _ => unreachable!(),
                },
                Err(e) => match *e {
                    bincode::ErrorKind::Io(e) if e.kind() == std::io::ErrorKind::UnexpectedEof => {
                        break
                    }
                    _ => unreachable!(),
                },
            };
        }
        fs::remove_file(dt.full_path).unwrap();
        fs::remove_dir_all(dt.dir_name).unwrap();
    }