diff --git a/crates/RustQuant_data/src/examples/example.csv b/crates/RustQuant_data/src/examples/read.csv similarity index 100% rename from crates/RustQuant_data/src/examples/example.csv rename to crates/RustQuant_data/src/examples/read.csv diff --git a/crates/RustQuant_data/src/examples/example.json b/crates/RustQuant_data/src/examples/read.json similarity index 100% rename from crates/RustQuant_data/src/examples/example.json rename to crates/RustQuant_data/src/examples/read.json diff --git a/crates/RustQuant_data/src/examples/example.parquet b/crates/RustQuant_data/src/examples/read.parquet similarity index 100% rename from crates/RustQuant_data/src/examples/example.parquet rename to crates/RustQuant_data/src/examples/read.parquet diff --git a/crates/RustQuant_data/src/io.rs b/crates/RustQuant_data/src/io.rs index 337309bd..63246528 100644 --- a/crates/RustQuant_data/src/io.rs +++ b/crates/RustQuant_data/src/io.rs @@ -159,17 +159,20 @@ impl DataScanner for Data { mod test_io { use super::*; + const READ_PATH: &str = "./src/examples/read"; + const WRITE_PATH: &str = "./src/examples/write"; + #[test] fn test_read_write_csv() -> Result<(), RustQuantError> { let mut data = Data { format: DataFormat::CSV, - path: String::from("./src/data/examples/example.csv"), + path: format!("{}.csv", READ_PATH), //String::from("./examples/example.csv"), data: DataFrame::default(), }; data.read()?; - data.path = String::from("./src/data/examples/write.csv"); + data.path = format!("{}.csv", WRITE_PATH); //String::from("./examples/write.csv"); data.write()?; @@ -182,13 +185,13 @@ mod test_io { fn test_read_write_json() -> Result<(), RustQuantError> { let mut data = Data { format: DataFormat::JSON, - path: String::from("./src/data/examples/example.json"), + path: format!("{}.json", READ_PATH), data: DataFrame::default(), }; data.read()?; - data.path = String::from("./src/data/examples/write.json"); + data.path = format!("{}.json", WRITE_PATH); data.write()?; @@ -201,13 +204,13 @@ mod test_io { fn test_read_write_parquet() -> Result<(), RustQuantError> { let mut data = Data { format: DataFormat::PARQUET, - path: String::from("./src/data/examples/example.parquet"), + path: format!("{}.parquet", READ_PATH), data: DataFrame::default(), }; data.read()?; - data.path = String::from("./src/data/examples/write.parquet"); + data.path = format!("{}.parquet", WRITE_PATH); data.write()?;