From e6cc8fa59bfe0e4083c678f78110afaeb60a3ed4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sun, 15 Oct 2023 18:54:38 +0200 Subject: [PATCH] Created tests directory --- rust/trexio/src/main.rs | 16 ---------------- rust/trexio/{src/test.rs => tests/write.rs} | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 18 deletions(-) delete mode 100644 rust/trexio/src/main.rs rename rust/trexio/{src/test.rs => tests/write.rs} (92%) diff --git a/rust/trexio/src/main.rs b/rust/trexio/src/main.rs deleted file mode 100644 index bd80371..0000000 --- a/rust/trexio/src/main.rs +++ /dev/null @@ -1,16 +0,0 @@ -use std::error::Error; - -mod test; - -fn main() -> Result<(), Box> { - println!("============================================"); - println!(" TREXIO VERSION : {}", trexio::PACKAGE_VERSION ); - println!("============================================"); - - let file_name = "test_write_rust.dir"; - - let back_end = trexio::BackEnd::Text; - test::test_write(file_name, back_end)?; - - Ok(()) -} diff --git a/rust/trexio/src/test.rs b/rust/trexio/tests/write.rs similarity index 92% rename from rust/trexio/src/test.rs rename to rust/trexio/tests/write.rs index 5e8f46a..abcaf81 100644 --- a/rust/trexio/src/test.rs +++ b/rust/trexio/tests/write.rs @@ -1,9 +1,8 @@ use trexio::back_end::BackEnd; use trexio::bitfield::Bitfield; -pub fn test_write(file_name: &str, back_end: BackEnd) -> Result<(), trexio::ExitCode> { - let () = trexio::info()?; +fn write(file_name: &str, back_end: BackEnd) -> Result<(), trexio::ExitCode> { // Prepare data to be written @@ -123,3 +122,19 @@ pub fn test_write(file_name: &str, back_end: BackEnd) -> Result<(), trexio::Exit trex_file.close() } + +#[test] +pub fn info() { + trexio::info(); +} + +#[test] +pub fn wite_text() { + write("test_write.dir", trexio::BackEnd::Text); +} + +#[test] +pub fn wite_hdf5() { + write("test_write.hdf5", trexio::BackEnd::Hdf5); +} +