updated unit test to show max colors supported and when each algorithm fails.
This commit is contained in:
parent
c2929e3d2b
commit
b36244fcbd
|
@ -51,12 +51,24 @@ public:
|
|||
BaseColorPickEntity::resetUniqueColors();
|
||||
|
||||
TestBaseColorPickEntity colorPicker;
|
||||
// This is the max color count this algorithm supports
|
||||
const int MAX_SUPPORTED_COLORS_USING_THIS_METHOD = 32767;
|
||||
for(unsigned int i = 0; i < MAX_SUPPORTED_COLORS_USING_THIS_METHOD; ++i) {
|
||||
bool duplicate = colorPicker.get_next_assign_color(colorPicker.getUniqueColorID());
|
||||
CPPUNIT_ASSERT_EQUAL( false,duplicate );
|
||||
}
|
||||
|
||||
BaseColorPickEntity::resetUniqueColors();
|
||||
|
||||
TestBaseColorPickEntity colorPicker2;
|
||||
// This is a test to prove when the algorithm fails
|
||||
const int MAX_SUPPORTED_COLORS_USING_THIS_METHOD_FAIL = 32768;
|
||||
for(unsigned int i = 0; i < MAX_SUPPORTED_COLORS_USING_THIS_METHOD_FAIL; ++i) {
|
||||
bool duplicate = colorPicker2.get_next_assign_color(colorPicker2.getUniqueColorID());
|
||||
CPPUNIT_ASSERT_EQUAL( (i+1 >= MAX_SUPPORTED_COLORS_USING_THIS_METHOD_FAIL),duplicate );
|
||||
}
|
||||
|
||||
BaseColorPickEntity::resetUniqueColors();
|
||||
BaseColorPickEntity::setTrackColorUse(false);
|
||||
}
|
||||
|
||||
|
@ -67,12 +79,24 @@ public:
|
|||
BaseColorPickEntity::resetUniqueColors();
|
||||
|
||||
TestBaseColorPickEntity colorPicker;
|
||||
// This is the max color count this algorithm supports
|
||||
const int MAX_SUPPORTED_COLORS_USING_THIS_METHOD = 472;
|
||||
for(unsigned int i = 0; i < MAX_SUPPORTED_COLORS_USING_THIS_METHOD; ++i) {
|
||||
bool duplicate = colorPicker.get_next_assign_color(colorPicker.getUniqueColorID());
|
||||
CPPUNIT_ASSERT_EQUAL( false,duplicate );
|
||||
}
|
||||
|
||||
BaseColorPickEntity::resetUniqueColors();
|
||||
|
||||
TestBaseColorPickEntity colorPicker2;
|
||||
// This is a test to prove when the algorithm fails
|
||||
const int MAX_SUPPORTED_COLORS_USING_THIS_METHOD_FAIL = 473;
|
||||
for(unsigned int i = 0; i < MAX_SUPPORTED_COLORS_USING_THIS_METHOD_FAIL; ++i) {
|
||||
bool duplicate = colorPicker2.get_next_assign_color(colorPicker2.getUniqueColorID());
|
||||
CPPUNIT_ASSERT_EQUAL( (i+1 >= MAX_SUPPORTED_COLORS_USING_THIS_METHOD_FAIL),duplicate );
|
||||
}
|
||||
|
||||
BaseColorPickEntity::resetUniqueColors();
|
||||
BaseColorPickEntity::setTrackColorUse(false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue