mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-29 01:34:29 +01:00
3D: say what an uncompared pair does in the sort limit's doc, and test the exact entries read
MAX_LOCAL_CHECKS's doc comment said pairs not reached keep their depth order; an uncompared pair adds no constraint, and past the step limit the first face left by depth goes next only when no face can. a_list_longer_than_the_room_left_is_not_read now asserts how many list entries are read at each room size, and fails when an over-long list is counted as read.
This commit is contained in:
1 parent
717ad768d8
commit
6d0408fd07
2 files changed
+7
-3
No files matched your search
@@ -1181,8 +1181,10 @@ impl Placed {
|
||||
}
|
||||
|
||||
/// The most pairs of faces [`local_order`] compares, together with the steps it takes to break
|
||||
/// rings of them ([`drawn_in_pairs_order`]), and the most pairs [`cut_stroke_faces`] compares; the
|
||||
/// pairs they have not reached by then keep the order of their depths.
|
||||
/// rings of them ([`drawn_in_pairs_order`]), and the most pairs [`cut_stroke_faces`] compares. A
|
||||
/// pair not compared by then adds no constraint on the order (the pairs that were compared can
|
||||
/// still move its faces), and once the steps run out the first face left by depth goes next only
|
||||
/// when no face can.
|
||||
const MAX_LOCAL_CHECKS: usize = 4_000_000;
|
||||
|
||||
/// The polygon of `f` and the sign of its turns, when `f` is a face turned toward the viewer other
|
||||
|
||||
@@ -1214,10 +1214,12 @@ fn a_list_longer_than_the_room_left_is_not_read() {
|
||||
before.extend((2..2 + wide).flat_map(|f| [(f, 1), (1, f)]));
|
||||
let order: Vec<usize> = (0..2 + wide).collect();
|
||||
// Room for the lists (a quarter of the pairs) but not for 1's list, and room for it.
|
||||
for room in [before.len().div_ceil(4), wide - 1, wide + 3] {
|
||||
// With too little room only 0's one-entry list is read; with room for both, 1's list as well.
|
||||
for (room, want) in [(before.len().div_ceil(4), 1), (wide - 1, 1), (wide + 3, wide + 1)] {
|
||||
super::LIST_ENTRIES_READ.with(|read| read.set(0));
|
||||
let (drawn, taken) = in_pairs_order(&order, &before, &[], room);
|
||||
let read = super::LIST_ENTRIES_READ.with(|read| read.get());
|
||||
assert_eq!(read, want, "room {room}: {read} entries read, {taken} steps");
|
||||
assert!(read <= taken && taken <= room, "room {room}: {read} entries read, {taken} steps");
|
||||
assert_eq!(drawn.len(), order.len());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user