Closed hfossli closed 9 years ago
Test report
Running 39 test cases...
/Users/hfossli/Projects/Rhea/unit_tests/unit_tests.cpp:758: error in "required_strength_stay": check v.value() == 2 failed [0 != 2]
/Users/hfossli/Projects/Rhea/unit_tests/unit_tests.cpp:769: error in "required_strength_stay_and_constraint": check y.value() == 2 failed [0 != 2]
/Users/hfossli/Projects/Rhea/unit_tests/unit_tests.cpp:778: error in "required_strength_stay_and_constraint": check v.value() == 2 failed [0 != 2]
/Users/hfossli/Projects/Rhea/unit_tests/unit_tests.cpp:779: error in "required_strength_stay_and_constraint": check y.value() == 4 failed [2 != 4]
*** 4 failures detected in test suite "rhea"
'required' is a special value, the weight factor isn't meaningful here. (Now we know what happens when the immovable object meets the unstoppable force, it appears the stay constraint wins. ;) )
If I got you right you are saying that the weight factor is the problem. Removing that from the unit test still yields the same output/error.
BOOST_AUTO_TEST_CASE(required_strength_stay)
{
variable v(0);
simplex_solver solver;
solver.add_stay(v, strength::required());
BOOST_CHECK_EQUAL(v.value(), 0);
solver.add_edit_var(v);
solver.begin_edit();
solver.suggest_value(v, 2);
solver.end_edit();
BOOST_CHECK_EQUAL(v.value(), 2);
}
Result
error in "required_strength_stay": check v.value() == 2 failed [0 != 2]
The value remains 0 because the edit constraint is weaker than the stay constraint in this case. (Stays are weak and edits are strong by default.)
Aha. It's details like this that would be awesome to have documented.
This is quite good, but it too short IMO http://cassowary.readthedocs.org/en/latest/
For some reason, people started starring this project left and right in the past couple of days. Maybe this is a good time to get some documentation going. ;)
That Python implementation you linked to explains the concepts of Cassowary very well, that's definitely a good basis.
I'm not sure if this is a bug or not. I wrote some unit tests derived from the test
required_strength
which I expect to pass. Am I missing something?