use lj_rust::conf::{Conf, DacFamily, HeliosConf, EtherDreamConf}; #[test] fn it_loads_a_valid_conf() { let result = Conf::new("tests/settings/valid"); assert!(result.is_ok()); } #[test] fn it_fails_invalid_conf() { let result = Conf::new("tests/settings/empty"); assert!(result.is_err()); } #[test] fn it_finds_struct_fields() { let config = Conf::new("tests/settings/valid").unwrap(); assert_eq!(config.laser_id, 0); assert_eq!(config.debug, true); assert_eq!(config.redis_url, "redis://127.0.0.1:6379/"); assert!(match config.dac { DacFamily::Helios(HeliosConf { id: 0 }) => true, _ => false, }); } #[test] fn it_finds_etherdream_fields() { let config = Conf::new("tests/settings/valid_etherdream").unwrap(); assert!(match config.dac { DacFamily::Etherdream(EtherDreamConf { url }) if url == "192.168.1.68" => true, _ => false, }); }