Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SourceFiles/Item3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ bool Item3D::IsAboveBelow( item_t other )
double ow1 = other->getWLocation();
double ow2 = ow1 + other->side_1()->size() - 1;
double ol1 = other->getLLocation();
double ol2 = ow2 + other->side_3()->size() - 1;
double ol2 = ol1 + other->side_3()->size() - 1;


// cout << mw1 <<" "<< mw2 <<" "<< ml1 <<" "<< ml2 <<"\n"<<
Expand Down
21 changes: 21 additions & 0 deletions unit_test/unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,27 @@ TEST( OverlapArea )
CHECK_CLOSE( i3->AreaWidthLength() / 2, i3->OverlapArea( i2 ), 0.1 );

}

TEST(AboveBelowBug)
{
std::shared_ptr<Item> i1(new Item3D());
i1->set_side_1(new Side(1, 'w'));
i1->set_side_2(new Side(2, 'h'));
i1->set_side_3(new Side(3, 'l'));
i1->setWLocation(0);
i1->setHLocation(0);
i1->setLLocation(7);
std::shared_ptr<Item> i2(new Item3D());
i2->set_side_1(new Side(1, 'w'));
i2->set_side_2(new Side(2, 'h'));
i2->set_side_3(new Side(3, 'l'));
i2->setWLocation(0);
i2->setHLocation(200);
i2->setLLocation(5);

CHECK(i1->IsAboveBelow(i2));
}

int main(int argc, char *argv[])
{
return raven::set::UnitTest::RunAllTests();
Expand Down