Skip to content

Commit 6bb2be1

Browse files
committed
add tests
1 parent 5037d9e commit 6bb2be1

File tree

1 file changed

+10
-10
lines changed
  • oscars/src/collectors/mark_sweep_arena2

1 file changed

+10
-10
lines changed

oscars/src/collectors/mark_sweep_arena2/tests.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ fn alive_wm() {
437437

438438
#[test]
439439
fn two_distinct_keys_wm() {
440-
// ensure two distinct Gc keys produce unique addresses and don't collide
440+
// Ensure two distinct Gc keys produce unique addresses and don't collide
441441
// in the HashTable or corrupt each other's entries
442442
let collector = &mut MarkSweepGarbageCollector::default()
443443
.with_arena_size(256)
@@ -450,7 +450,7 @@ fn two_distinct_keys_wm() {
450450
map.insert(&key1, 10u64, collector);
451451
map.insert(&key2, 20u64, collector);
452452

453-
// verify both entries are independent and accessible
453+
// Verify both entries are independent and accessible
454454
assert_eq!(
455455
map.get(&key1),
456456
Some(&10u64),
@@ -470,7 +470,7 @@ fn two_distinct_keys_wm() {
470470
"key2 should be alive",
471471
);
472472

473-
// dropping one key must prune only its entry, leaving the other intact
473+
// Dropping one key must prune only its entry, leaving the other intact
474474
drop(key1);
475475
collector.collect();
476476

@@ -484,7 +484,7 @@ fn two_distinct_keys_wm() {
484484
"key2 reported dead while still rooted",
485485
);
486486

487-
// both keys dead and collected means no leaks
487+
// Both keys dead and collected means no leaks
488488
drop(key2);
489489
collector.collect();
490490

@@ -497,7 +497,7 @@ fn two_distinct_keys_wm() {
497497

498498
#[test]
499499
fn two_maps_same_key_wm() {
500-
// same Gc key registered in two independent WeakMaps; each must hold its
500+
// Same Gc key registered in two independent WeakMaps, each must hold its
501501
// own value and neither map's operations must bleed into the other
502502
let collector = &mut MarkSweepGarbageCollector::default()
503503
.with_arena_size(256)
@@ -525,8 +525,8 @@ fn two_maps_same_key_wm() {
525525

526526
#[test]
527527
fn drop_map_with_live_key_wm() {
528-
// dropping a WeakMap while its key is still alive must not corrupt the
529-
// collector; it skips dead maps during prune_dead_entries
528+
// Dropping a WeakMap while its key is still alive must not corrupt the
529+
// collector, it skips dead maps during prune_dead_entries
530530
let collector = &mut MarkSweepGarbageCollector::default()
531531
.with_arena_size(256)
532532
.with_heap_threshold(512);
@@ -536,13 +536,13 @@ fn drop_map_with_live_key_wm() {
536536
{
537537
let mut map = WeakMap::<u64, u64>::new(collector);
538538
map.insert(&key, 100u64, collector);
539-
// map dropped here; WeakMap::drop sets is_alive = false
539+
// Map dropped here, WeakMap::drop sets is_alive = false
540540
}
541541

542-
// collector must handle the dead map entry without panic or corruption
542+
// Collector must handle the dead map entry without panic or corruption
543543
collector.collect();
544544

545-
// key still live; drop it then collect to verify no leak
545+
// Key still live, drop it then collect to verify no leak
546546
drop(key);
547547
collector.collect();
548548

0 commit comments

Comments
 (0)