Here are descriptions of the issues present in the 8 buggy implementations in the autograder. Use these issues to design tests that will detect the bugs and improve your coverage.
Bug 1: | The implementation treats the corner parameter passed into the constructor as the lower left corner of the bounding box, rather than the upper left corner. |
---|---|
Bug 2: | The area calculation is incorrect. |
Bug 3: | isEmpty() returns whether the box has area 0 rather than whether it contains 0 points. |
Bug 4: | One of the inequalities checked in containsPoint() is strict, but the correct inequality should be weak. |
Bug 5: | Within the containsPoint() definition, the implementer mixed up the width and height of the box in one place. |
Bug 6: | The containsBox() method has faulty logic for handling empty bounding boxes. |
Bug 7: | There is an error in the calculation of the intersection bounding box in intersectWith() where a minimum is calculated where a maximum should be (and vice versa). |
Bug 8: | There is an error in the calculation of the intersection bounding box in intersectWith() where the implementer mixes up the target box's height and the parameter box's height in one place. |