Beispiel #1
0
int main()
{
    init(&f**k);
    char* ch;
    T_game gm;
    T_comp cp;
    T_Achi ac;
    int i,j,k;
    for(i=1; i<=100; ++i) {
        sprintf(cp.Name,"%d",i);
        sprintf(cp.Description,"%d",i);
        T_Comp *ci=InsertCompany(CompanyFirst(&f**k),cp);
        for(j=1; j<=100; ++j) {
            sprintf(gm.Name,"%d,%d",i,j);
            sprintf(gm.Description,"%d,%d",j,i);
            T_Game *gi=InsertGame(GameFirst_c(ci),gm);
            for(k=1; k<=100; ++k) {
                sprintf(ac.Name,"%d,%d,%d",i,j,k);
                sprintf(ac.Description,"%d,%d,%d",k,j,i);
                addAchievev(ac.Name,ac.Description,gi);
            }
        }
        printf("Insert Company %d\n",i);
    }
    T_game model;
    givestr(model.Name,"1");
    printf("%d\n",CountGame(GAME_COMPARENAME,model,&f**k));
    for(i=1; i<=50; ++i) DelCompany(CompanyLast(&f**k));
    clean_up(&f**k);
    printf("Program exited with no error\n");
    return(0);
}
	int run_test_case( int casenum ) {
		switch( casenum ) {
		case 0: {
			int maxAdd                = 3;
			int goal                  = 20;
			int next                  = 10;
			int expected              = 3;

			clock_t moj_start_time    = clock();
			int received              = CountGame().howMany( maxAdd, goal, next );
			return verify_case( casenum, expected, received, clock()-moj_start_time );
		}
		case 1: {
			int maxAdd                = 5;
			int goal                  = 20;
			int next                  = 10;
			int expected              = 5;

			clock_t moj_start_time    = clock();
			int received              = CountGame().howMany( maxAdd, goal, next );
			return verify_case( casenum, expected, received, clock()-moj_start_time );
		}
		case 2: {
			int maxAdd                = 5;
			int goal                  = 20;
			int next                  = 9;
			int expected              = -1;

			clock_t moj_start_time    = clock();
			int received              = CountGame().howMany( maxAdd, goal, next );
			return verify_case( casenum, expected, received, clock()-moj_start_time );
		}
		case 3: {
			int maxAdd                = 4;
			int goal                  = 50;
			int next                  = 50;
			int expected              = 1;

			clock_t moj_start_time    = clock();
			int received              = CountGame().howMany( maxAdd, goal, next );
			return verify_case( casenum, expected, received, clock()-moj_start_time );
		}

		// custom cases

/*      case 4: {
			int maxAdd                = ;
			int goal                  = ;
			int next                  = ;
			int expected              = ;

			clock_t moj_start_time    = clock();
			int received              = CountGame().howMany( maxAdd, goal, next );
			return verify_case( casenum, expected, received, clock()-moj_start_time );
		}*/
/*      case 5: {
			int maxAdd                = ;
			int goal                  = ;
			int next                  = ;
			int expected              = ;

			clock_t moj_start_time    = clock();
			int received              = CountGame().howMany( maxAdd, goal, next );
			return verify_case( casenum, expected, received, clock()-moj_start_time );
		}*/
/*      case 6: {
			int maxAdd                = ;
			int goal                  = ;
			int next                  = ;
			int expected              = ;

			clock_t moj_start_time    = clock();
			int received              = CountGame().howMany( maxAdd, goal, next );
			return verify_case( casenum, expected, received, clock()-moj_start_time );
		}*/
		default:
			return -1;
		}
	}