Esempio n. 1
0
int main()
{



	random_fill(0,0x7fffffff,6,list0,list1,list2,list3,list4,list5);
    //random_fill(0,N,6,list0,list1,list2,list3,list4,list5);
    test_sort(list0,0,N-1,"my quick_sort_0",quick_sort_0);

    test_sort(list1,0,N-1,"my quick_sort_1",quick_sort_1);

    test_sort(list2,0,N-1,"other_quick_sort_0",other_quick_sort_0);
    test_sort(list3,0,N-1,"other eq_sort",eq_sort);
   // test_sort(list3,0,N-1,"clib_quick_sort",clib_quick_sort);

	test_sort1(list4,0,N-1,"other bq_sort",bq_sort);

	test_sort1(list5,0,N-1,"my quick_sort_2",quick_sort_2);



    return 0;


}
void Test::runTests()
{

        int score = 0;

        std::cerr << "\n\n=========================\n";
        std::cerr << "   RUNNING TEST SUITE    \n";
        std::cerr << "=========================\n\n";

        //Run test and award points where appropriate
        std::cerr << "\n\n=========================\n";
        std::cerr << "   SORTS TESTS    \n";
        std::cerr << "=========================\n\n";
        //Sort tests
        score += test_sort1() ? 1: 0;
        score += test_sort2() ? 1: 0;
        score += test_sort3() ? 1: 0;
        score += test_sort4() ? 1: 0;
        score += test_sort5() ? 1: 0;
        score += test_sort6() ? 1: 0;
        score += test_sort7() ? 1: 0;
        score += test_sort8() ? 1: 0;
        score += test_sort9() ? 1: 0;
        score += test_sort10() ? 1: 0;
        score += test_sort11() ? 1: 0;
        score += test_sort12() ? 1: 0;
        score += test_sort13() ? 1: 0;
        score += test_sort14() ? 1: 0;
        score += test_sort15() ? 1 : 0;
        score += test_sort16() ? 1 : 0;
        score += test_sort17() ? 2 : 0;
        score += test_sort18() ? 2: 0;
        score += test_sort19() ? 2: 0;
        score += test_sort20() ? 2: 0;
        score += test_sort21() ? 3: 0;
        score += test_sort22() ? 3: 0;
        score += test_sort23() ? 3: 0;
        score += test_sort24() ? 3: 0;
        score += test_sort25() ? 3: 0;
        score += test_sort26() ? 3: 0;


        std::cerr << "\n\n=========================\n";
        std::cerr << "   NUMBER FILE GENERATOR TESTS    \n";
        std::cerr << "=========================\n\n";

        //Number file generator tests
        score += test_NumFileGen1() ? 3: 0;
        score += test_NumFileGen2() ? 3: 0;
        score += test_NumFileGen3() ? 3: 0;
        score += test_NumFileGen4() ? 3: 0;
        score += test_NumFileGen5() ? 3: 0;
        score += test_NumFileGen6() ? 3: 0;


        std::cerr << "\n\n=========================\n";
        std::cerr << "   NUMBER FILE DRIVER TESTS    \n";
        std::cerr << "=========================\n\n";

        score += test_NumFileDriver1() ? 2: 0;
        score += test_NumFileDriver2() ? 2: 0;
        score += test_NumFileDriver3() ? 2: 0;
        score += test_NumFileDriver4() ? 2: 0;

        std::cerr << "\n\n=========================\n";
        std::cerr << "   SORT FILE DRIVER TESTS    \n";
        std::cerr << "=========================\n\n";
        score += test_SortDriver1() ? 2: 0;
        score += test_SortDriver2() ? 2: 0;
        score += test_SortDriver3() ? 2: 0;
        score += test_SortDriver4() ? 2: 0;
        score += test_SortDriver5() ? 2: 0;
        score += test_SortDriver6() ? 2: 0;

        std::cerr << "Score: " << score << " / " << MAX_SCORE << std::endl;
}