jasonrhansen / cut-optimizer-2d

2D Cut Optimizer
Apache License 2.0
19 stars 11 forks source link

Fix issue where duplicate cut pieces cause a subtract overflow error. #6

Closed kenianbei closed 3 years ago

kenianbei commented 3 years ago

Found another bug where identical cut pieces cause a subtract overflow error. You can run the test without the lib.rs change to see the problem in action. I'm not sure exactly what's going on but when I debug somehow cut_piece.quantity can reach Some(0) and still iterate.

This is the error: attempt to subtract with overflow thread 'tests::guillotine_stock_duplicate_cut_piece' panicked at 'attempt to subtract with overflow', src/lib.rs:242:13