Skip to content

Commit

Permalink
Append missing tests for resources
Browse files Browse the repository at this point in the history
Append missing tests for resources and fix some typo.

Signed-off-by: Jing Liu <[email protected]>
  • Loading branch information
Jing Liu authored and jiangliu committed Jan 22, 2020
1 parent 66166a3 commit 3daea68
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion coverage_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"coverage_score": 78.7,
"coverage_score": 79.9,
"exclude_path": "",
"crate_features": ""
}
21 changes: 19 additions & 2 deletions src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ mod tests {
assert_eq!(align, 0x1000);
assert_eq!(size, 0x2000);
} else {
panic!("Pio resource constraint is invalid.");
panic!("Mmio resource constraint is invalid.");
}

if let ResourceConstraint::MmioAddress { range, align, size } =
Expand All @@ -411,7 +411,24 @@ mod tests {
assert_eq!(align, 0x2000);
assert_eq!(size, 0x2000);
} else {
panic!("Pio resource constraint is invalid.");
panic!("Mmio resource constraint is invalid.");
}

if let ResourceConstraint::LegacyIrq { irq } =
ResourceConstraint::new_legacy_irq(Some(0x123))
{
assert_eq!(irq, Some(0x123));
} else {
panic!("IRQ resource constraint is invalid.");
}

if let ResourceConstraint::KvmMemSlot { slot, size } =
ResourceConstraint::new_kvm_mem_slot(0x1000, Some(0x2000))
{
assert_eq!(slot, Some(0x2000));
assert_eq!(size, 0x1000);
} else {
panic!("KVM slot resource constraint is invalid.");
}
}
}

0 comments on commit 3daea68

Please sign in to comment.