Skip to content

Commit 3daea68

Browse files
Jing Liujiangliu
Jing Liu
authored andcommitted
Append missing tests for resources
Append missing tests for resources and fix some typo. Signed-off-by: Jing Liu <[email protected]>
1 parent 66166a3 commit 3daea68

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

coverage_config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"coverage_score": 78.7,
2+
"coverage_score": 79.9,
33
"exclude_path": "",
44
"crate_features": ""
55
}

src/resources.rs

+19-2
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ mod tests {
401401
assert_eq!(align, 0x1000);
402402
assert_eq!(size, 0x2000);
403403
} else {
404-
panic!("Pio resource constraint is invalid.");
404+
panic!("Mmio resource constraint is invalid.");
405405
}
406406

407407
if let ResourceConstraint::MmioAddress { range, align, size } =
@@ -411,7 +411,24 @@ mod tests {
411411
assert_eq!(align, 0x2000);
412412
assert_eq!(size, 0x2000);
413413
} else {
414-
panic!("Pio resource constraint is invalid.");
414+
panic!("Mmio resource constraint is invalid.");
415+
}
416+
417+
if let ResourceConstraint::LegacyIrq { irq } =
418+
ResourceConstraint::new_legacy_irq(Some(0x123))
419+
{
420+
assert_eq!(irq, Some(0x123));
421+
} else {
422+
panic!("IRQ resource constraint is invalid.");
423+
}
424+
425+
if let ResourceConstraint::KvmMemSlot { slot, size } =
426+
ResourceConstraint::new_kvm_mem_slot(0x1000, Some(0x2000))
427+
{
428+
assert_eq!(slot, Some(0x2000));
429+
assert_eq!(size, 0x1000);
430+
} else {
431+
panic!("KVM slot resource constraint is invalid.");
415432
}
416433
}
417434
}

0 commit comments

Comments
 (0)