/// Tests the Key Functions /// @return True if all tests were executed, false if not bool KeySignatureTestSuite::TestCaseKey() { //------Last Checked------// // - Dec 11, 2004 KeySignature keySignature; TEST(wxT("SetKey - invalid key type"), !keySignature.SetKey(44, KeySignature::threeFlats)); TEST(wxT("SetKey - invalid key accidentals"), !keySignature.SetKey(KeySignature::minorKey, 44)); TEST(wxT("SetKey - valid"), keySignature.SetKey(KeySignature::minorKey, KeySignature::threeFlats) && (keySignature.GetKeyType() == KeySignature::minorKey) && (keySignature.GetKeyAccidentals() == KeySignature::threeFlats) ); // TEST CASE: IsSameKey { KeySignature keySignature(KeySignature::minorKey, KeySignature::threeFlats); keySignature.Show(); KeySignature keySignature2(KeySignature::minorKey, KeySignature::threeFlats); KeySignature keySignature3(KeySignature::majorKey, KeySignature::threeFlats); KeySignature keySignature4(KeySignature::minorKey, KeySignature::fourFlats); TEST(wxT("IsSameKey - true"), keySignature.IsSameKey(keySignature2)); TEST(wxT("IsSameKey - false"), !keySignature.IsSameKey(keySignature3)); TEST(wxT("IsSameKey - false"), !keySignature.IsSameKey(keySignature4)); } return (true); }
/// Tests the Key Type Functions /// @return True if all tests were executed, false if not bool KeySignatureTestSuite::TestCaseKeyType() { //------Last Checked------// // - Dec 11, 2004 // TEST CASE: IsValidKeyType { wxByte i = KeySignature::majorKey; for (; i <= (KeySignature::minorKey + 1); i++) TEST(wxString::Format(wxT("IsValidKeyType - %d"), i), (KeySignature::IsValidKeyType(i) == (i <= KeySignature::minorKey)) ); } KeySignature keySignature; wxByte i = KeySignature::majorKey; for (; i <= (KeySignature::minorKey + 1); i++) TEST(wxString::Format(wxT("SetKeyType - %d"), i), (keySignature.SetKeyType(i) == (i <= KeySignature::minorKey)) && ((i > KeySignature::minorKey) ? 1 : (keySignature.GetKeyType() == i)) ); return (true); }