[wip] unit testing
- minor refactoring
This commit is contained in:
parent
d4cc102a0f
commit
b3bccbbf65
2 changed files with 11 additions and 7 deletions
|
|
@ -76,7 +76,10 @@ mod tests {
|
||||||
);
|
);
|
||||||
check_trait(format!("{chunk:?}"), repr_expect, "Debug", "Chunk");
|
check_trait(format!("{chunk:?}"), repr_expect, "Debug", "Chunk");
|
||||||
|
|
||||||
assert_eq!(chunk.get_file_id().to_string(), "");
|
assert_eq!(
|
||||||
|
chunk.get_file_id().to_string(),
|
||||||
|
sharry::FileID::default().to_string()
|
||||||
|
);
|
||||||
assert_eq!(chunk.get_offset(), mock_offset);
|
assert_eq!(chunk.get_offset(), mock_offset);
|
||||||
assert_eq!(chunk.get_data(), data);
|
assert_eq!(chunk.get_data(), data);
|
||||||
assert_eq!(chunk.get_length(), len);
|
assert_eq!(chunk.get_length(), len);
|
||||||
|
|
|
||||||
|
|
@ -122,20 +122,21 @@ mod tests {
|
||||||
let share_id = ShareID::from(true);
|
let share_id = ShareID::from(true);
|
||||||
let file_id = FileID::from(true);
|
let file_id = FileID::from(true);
|
||||||
|
|
||||||
assert!(matches!((&uri, &alias_id).check(), Ok(())));
|
assert!((&uri, &alias_id).check().is_ok());
|
||||||
assert!(matches!(share_id.check(), Ok(())));
|
assert!(share_id.check().is_ok());
|
||||||
assert!(matches!((&share_id, &file_id).check(), Ok(())));
|
assert!((&share_id, &file_id).check().is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn default_is_valid() {
|
fn default_is_valid() {
|
||||||
let uri = Uri::default();
|
let uri = Uri::default();
|
||||||
|
let alias_id = AliasID::from(true); // no `impl Default`
|
||||||
let share_id = ShareID::default();
|
let share_id = ShareID::default();
|
||||||
let file_id = FileID::default();
|
let file_id = FileID::default();
|
||||||
|
|
||||||
assert!(matches!((&uri, &AliasID::from(true)).check(), Ok(())));
|
assert!((&uri, &alias_id).check().is_ok());
|
||||||
assert!(matches!(share_id.check(), Ok(())));
|
assert!(share_id.check().is_ok());
|
||||||
assert!(matches!((&share_id, &file_id).check(), Ok(())));
|
assert!((&share_id, &file_id).check().is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue