Skip to content

Commit

Permalink
test: add tests for HET
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanholz committed Dec 4, 2024
1 parent 0b05bcb commit 9bb3e65
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions knuckles-parse/src/records/het.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,18 @@ mod tests {
assert_eq!(record.num_het_atoms, 25);
assert_eq!(record.text, None);
}

#[test]
#[cfg(feature = "serde")]
fn test_serde_serialization() {
let line = "HET UDP A1457 25 ";
let record: HetRecord = HetRecord::new(line);
let serialized = serde_json::to_string(&record).expect("Serialization failed");
assert_eq!(
serialized,
r#"{"het_id":"UDP","chain_id":"A","seq_num":1457,"i_code":null,"num_het_atoms":25,"text":null}"#
);
let deserialized = serde_json::from_str(&serialized).expect("Deserialization failed");
assert_eq!(record, deserialized);
}
}

0 comments on commit 9bb3e65

Please sign in to comment.