1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-03 20:54:07 +01:00

Created tests directory

This commit is contained in:
Anthony Scemama 2023-10-15 18:54:38 +02:00
parent 3cf8a8c431
commit e6cc8fa59b
2 changed files with 17 additions and 18 deletions

View File

@ -1,16 +0,0 @@
use std::error::Error;
mod test;
fn main() -> Result<(), Box<dyn Error>> {
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(())
}

View File

@ -1,9 +1,8 @@
use trexio::back_end::BackEnd; use trexio::back_end::BackEnd;
use trexio::bitfield::Bitfield; 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 // 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() 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);
}