コード例 #1
0
/**
 * Make sure disambiguating of Mappings works.
 */
void FMDIndexTests::testDisambiguate() {

    // Make some positions    
    Mapping mapped(TextPosition(1, 1));
    Mapping otherSide(TextPosition(0, 33)); 
    Mapping unmapped(TextPosition(0, 0), false);
    Mapping elsewhere(TextPosition(2, 10));
    
    // Make sure disambiguate does the right things
    CPPUNIT_ASSERT(index->disambiguate(mapped, otherSide) == mapped);
    CPPUNIT_ASSERT(index->disambiguate(otherSide, mapped) == otherSide);
    CPPUNIT_ASSERT(index->disambiguate(mapped, unmapped) == mapped);
    CPPUNIT_ASSERT(index->disambiguate(unmapped, mapped) == otherSide);
    CPPUNIT_ASSERT(index->disambiguate(unmapped, unmapped).is_mapped == false);
    CPPUNIT_ASSERT(index->disambiguate(elsewhere, mapped).is_mapped == false);
}
コード例 #2
0
bool RRSchedule::teams_feasible(int home, int away)
/* Check to ensure:
 1.  Not playing themself
 2.  Not playing elsewhere
 3.  Not played too much already that night
 4.  Not played twice more than another team overall
 5.  Not played too many times in that timeslot // Deprecated due to sorting
 6.  Will not force a wait of <x> hours // Deprecated due to sorting
 */
{
    return  (
             themself(home, away)
             and elsewhere(home,away)
             and that_night(home,away)
             and overall(home,away)
             //and balanced_time(home,away)
             //and check_wait_time(home,away)
             );
}