Skip to content

Commit

Permalink
clean up the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Nov 13, 2024
1 parent 3e9e39a commit 19039a7
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions demes/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,8 @@ fn test_load_from_nonexistent_file() {
let code = unsafe {
demes_graph_load_from_file(c_filename.as_ptr(), &mut error, &mut graph_from_file)
};
assert_eq!(code, 1);
assert_ne!(code, 0);
assert!(graph_from_file.is_null());
assert!(matches!(error.error, Some(ErrorDetails::BoxedError(_))))
}

Expand All @@ -1808,19 +1809,8 @@ fn test_load_from_null_file() {
let mut error = FFIError::default();
let code =
unsafe { demes_graph_load_from_file(std::ptr::null(), &mut error, &mut graph_from_file) };
assert_eq!(code, 1);
assert!(matches!(
error.error,
Some(ErrorDetails::UnexpectedNullPointer)
))
}

#[test]
fn test_load_from_null_file_all_other_ptr_null() {
let mut error = FFIError::default();
let code =
unsafe { demes_graph_load_from_file(std::ptr::null(), &mut error, std::ptr::null_mut()) };
assert_eq!(code, 1);
assert_ne!(code, 0);
assert!(graph_from_file.is_null());
assert!(matches!(
error.error,
Some(ErrorDetails::UnexpectedNullPointer)
Expand Down

0 comments on commit 19039a7

Please sign in to comment.