int main(void) { LOG("PieceRotation test starting."); try { testBackAndForth(); testFullRotation(); testPermutation(cPiece::cConnector::RotateDirection); testPermutation(cPiece::cConnector::RotateDirectionCW); testPermutation(cPiece::cConnector::RotateDirectionCCW); } catch (const cTestFailure & f) { LOGERROR("Test failed:\tExpression: %s\n\tFile: %s (%d)", f.m_Expression.c_str(), f.m_FileName.c_str(), f.m_Line); return 1; } catch (const std::exception & exc) { LOGERROR("Exception caught: %s", exc.what()); return 2; } LOG("PieceRotation test succeeded."); return 0; }
/*--------------------------------------------------------*/ void buildPermutations( int level ) { int j; if (level == size) testPermutation(); else { for (j=0; j<size; j++) { if (available[j]) { available[j] = FALSE; permutation[level] = j+1; buildPermutations( level+1 ); available[j] = TRUE; } } } }