Example #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);
}
Example #2
0
/// Tests the Type Functions
/// @return True if all tests were executed, false if not
bool BarlineTestSuite::TestCaseType()
{
    //------Last Checked------//
    // - Jan 4, 2005
    
    // TEST CASE: IsValidType
    {
        wxByte i = Barline::bar;
        for (; i <= (Barline::doubleBarFine + 1); i++)
        {
            TEST(wxString::Format(wxT("IsValidType - %d"), i), 
                (Barline::IsValidType(i) == (i <= Barline::doubleBarFine))
            );
        }
    }
    
    // TEST CASE: SetType
    {
        Barline barline;
        wxByte i = Barline::bar;
        for (; i <= (Barline::doubleBarFine + 1); i++)
        {
            TEST(wxString::Format(wxT("SetType - %d"), i), 
                (barline.SetType(i) == (i <= Barline::doubleBarFine)) &&
                ((i > Barline::doubleBarFine) ? 1 : ((barline.GetType() == i)) &&
                (barline.IsBar() == (i == Barline::bar)) &&
                (barline.IsDoubleBar() == (i == Barline::doubleBar)) &&
                (barline.IsFreeTimeBar() == (i == Barline::freeTimeBar)) &&
                (barline.IsRepeatStart() == (i == Barline::repeatStart)) &&
                (barline.IsRepeatEnd() == (i == Barline::repeatEnd)) &&
                (barline.IsDoubleBarFine() == (i == Barline::doubleBarFine)))
            );
        }
    }
    return (true);
}