コード例 #1
0
/// Tests the Constructors
/// @return True if all tests were executed, false if not
bool BarlineTestSuite::TestCaseConstructor()
{
    //------Last Checked------//
    // - Jan 4, 2005
    
    // TEST CASE: Default Constructor
    {
        Barline barline;
        TEST(wxT("Default Constructor"),
            (barline.GetPosition() == Barline::DEFAULT_POSITION) &&
            (barline.GetType() == Barline::bar) &&
            (barline.GetRepeatCount() == 0)
        );
    }
    
    // TEST CASE: Primary Constructor
    {
        Barline barline(14, Barline::repeatEnd, 12);
        TEST(wxT("Primary Constructor"),
            (barline.GetPosition() == 14) &&
            (barline.GetType() == Barline::repeatEnd) &&
            (barline.GetRepeatCount() == 12)
        );
    }
    
    // TEST CASE: Copy Constructor
    {
        Barline barline(14, Barline::repeatEnd, 12);
        Barline barline2(barline);
        TEST(wxT("Copy Constructor"),
            (barline2 == barline)
        );
    }
    return (true);
}
コード例 #2
0
/// Tests the Repeat Count Functions
/// @return True if all tests were executed, false if not
bool BarlineTestSuite::TestCaseRepeatCount()
{
    //------Last Checked------//
    // - Jan 4, 2005
    
    // TEST CASE: IsValidRepeatCount
    {
        TEST(wxT("IsValidRepeatCount - 0"), Barline::IsValidRepeatCount(0));
        
        wxByte i = Barline::MIN_REPEAT_COUNT - 1;
        for (; i <= (Barline::MAX_REPEAT_COUNT + 1); i++)
        {
            TEST(wxString::Format(wxT("IsValidRepeatCount - %d"), i),
                (Barline::IsValidRepeatCount(i) ==
                ((i >= Barline::MIN_REPEAT_COUNT) &&
                (i <= Barline::MAX_REPEAT_COUNT)))
            );         
        }
    }
    
    // TEST CASE: SetRepeatCount
    {
        Barline barline;
        TEST(wxT("SetRepeatCount - 0"), (barline.SetRepeatCount(0) &&
            (barline.GetRepeatCount() == 0)));
        wxByte i = Barline::MIN_REPEAT_COUNT - 1;
        for (; i <= (Barline::MAX_REPEAT_COUNT + 1); i++)
        {
            TEST(wxString::Format(wxT("SetRepeatCount - %d"), i),
                (barline.SetRepeatCount(i) ==
                ((i >= Barline::MIN_REPEAT_COUNT) &&
                (i <= Barline::MAX_REPEAT_COUNT))) &&
                (((i < Barline::MIN_REPEAT_COUNT) ||
                (i > Barline::MAX_REPEAT_COUNT)) ? 1 :
                (barline.GetRepeatCount() == i))
            );
        }
    }
    return (true);
}