Skip to content

Commit

Permalink
See if we can get better errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Oct 5, 2023
1 parent 9643a7c commit dad21bf
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions test/unit/stdlib/collections/bitset.c3
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ fn void! growable_set_get()
{
GrowableBitSet bs;
bs.tinit();
assert(bs.cardinality() == 0);
assert(bs.cardinality() == 0, "Invalid cardinality");

assert(!bs.get(0));
assert(!bs.get(0), "Get was true");
bs.set(0);
assert(bs.get(0));
assert(bs.cardinality() == 1);
assert(bs.len() == 1);
assert(bs.get(0), "Get should be true");
assert(bs.cardinality() == 1, "Cardinality should be 1");
assert(bs.len() == 1, "Len should be 1");

assert(!bs.get(2000));
assert(!bs.get(2000), "Get 2000 should be false");
bs[2000] = true;
assert(bs.get(2000));
assert(bs.cardinality() == 2);
assert(bs.get(2000), "Get 2000 should be true");
assert(bs.cardinality() == 2, "Cardinality should be 2");

assert(bs.data.len() == 251);
assert(bs.len() == 2001);
assert(bs.data.len() == 251, "Len should be 251");
assert(bs.len() == 2001, "Len should be 2001");

List found;
found.tinit();
Expand All @@ -79,14 +79,14 @@ fn void! growable_set_get()
assert(x);
found.push(i);
default:
assert(!x);
assert(!x, "Should not get here");
}
}
assert(found.array_view() == usz[]{0, 2000});
assert(found.array_view() == usz[]{0, 2000}, "Array view should hold 2");

bs.unset(0);
assert(!bs.get(0));
assert(!bs.get(0), "Get should be false");
bs[2000] = false;
assert(!bs.get(2000));
assert(bs.cardinality() == 0);
assert(!bs.get(2000), "Get should be false");
assert(bs.cardinality() == 0, "Cardinality should be 0");
}

0 comments on commit dad21bf

Please sign in to comment.