use base_sequence_compression::{compress_sequence, decompress_sequence}; #[cfg(test)] mod tests { use super::*; #[test] fn test_compress_decompress() { let dna_sequence = "ACGTACGTACGT"; let compressed = compress_sequence(dna_sequence); let decompressed = decompress_sequence(&compressed); assert_eq!(dna_sequence, decompressed); } #[test] fn test_empty_sequence() { let dna_sequence = ""; let compressed = compress_sequence(dna_sequence); let decompressed = decompress_sequence(&compressed); assert_eq!(dna_sequence, decompressed); } #[test] fn test_single_character_a() { let dna_sequence = "A"; let compressed = compress_sequence(dna_sequence); let decompressed = decompress_sequence(&compressed); assert_eq!(dna_sequence, decompressed); } #[test] fn test_single_character_c() { let dna_sequence = "C"; let compressed = compress_sequence(dna_sequence); let decompressed = decompress_sequence(&compressed); assert_eq!(dna_sequence, decompressed); } #[test] fn test_single_character_t() { let dna_sequence = "T"; let compressed = compress_sequence(dna_sequence); let decompressed = decompress_sequence(&compressed); assert_eq!(dna_sequence, decompressed); } #[test] fn test_single_character_g() { let dna_sequence = "G"; let compressed = compress_sequence(dna_sequence); let decompressed = decompress_sequence(&compressed); assert_eq!(dna_sequence, decompressed); } #[test] fn test_non_multiple_of_four_length() { let dna_sequence = "ACGTACGTA"; let compressed = compress_sequence(dna_sequence); let decompressed = decompress_sequence(&compressed); assert_eq!(dna_sequence, decompressed); } #[test] fn test_non_multiple_of_four_length_2() { let dna_sequence = "ACGTACGTAC"; let compressed = compress_sequence(dna_sequence); let decompressed = decompress_sequence(&compressed); assert_eq!(dna_sequence, decompressed); } #[test] fn test_non_multiple_of_four_length_3() { let dna_sequence = "ACGTACGTACG"; let compressed = compress_sequence(dna_sequence); let decompressed = decompress_sequence(&compressed); assert_eq!(dna_sequence, decompressed); } #[test] fn test_lower_case() { let dna_sequence = "acgt"; let compressed = compress_sequence(dna_sequence); let decompressed = decompress_sequence(&compressed); assert_eq!(dna_sequence.to_uppercase(), decompressed); } #[test] #[should_panic] fn test_invalid_sequence() { let dna_sequence = "ACXGT"; compress_sequence(dna_sequence); } }