main
Inga 🏳‍🌈 1 year ago
parent 786a3bbeaa
commit 4280d1e6c6
  1. 14
      hostnames_allocator/tests/ranged_number_allocator_tests.rs

@ -96,6 +96,13 @@ fn allocate_combines_two_adjacent_ranges_starting_with_one() {
check_allocator(allocator, &[(1, 15)]);
}
#[test]
fn allocate_combines_two_adjacent_ranges_starting_with_one_extra() {
let mut allocator = create_allocator(&[(1, 5), (7, 15), (20, 30)]);
assert_eq!(allocator.allocate(), 6);
check_allocator(allocator, &[(1, 15), (20, 30)]);
}
#[test]
fn allocate_adds_value_for_range_starting_with_two() {
let mut allocator = create_allocator(&[(2, 10)]);
@ -103,6 +110,13 @@ fn allocate_adds_value_for_range_starting_with_two() {
check_allocator(allocator, &[(1, 10)]);
}
#[test]
fn allocate_adds_value_for_range_starting_with_two_extra() {
let mut allocator = create_allocator(&[(2, 10), (20, 30)]);
assert_eq!(allocator.allocate(), 1);
check_allocator(allocator, &[(1, 10), (20, 30)]);
}
#[test]
fn allocate_adds_value_for_range_starting_with_ten() {
let mut allocator = create_allocator(&[(10, 20)]);

Loading…
Cancel
Save