コード例 #1
0
ファイル: unittest1.c プロジェクト: Jmmyr41/cs362f15
int main() {
  srand(time(0));

  int errorCount = 0;

  if (testUpdateCoins(2, 0)) {
    printf("Error testing updateCoins()\n");
    errorCount++;
  }
  if (testUpdateCoins(2, 1)) {
    printf("Error testing updateCoins()\n");
    errorCount++;
  }
  if (testUpdateCoins(2, 5)) {
    printf("Error testing updateCoins()\n");
    errorCount++;
  }
  if (testUpdateCoins(2, -1)) {
    printf("Error testing updateCoins()\n");
    errorCount++;

  }
  if (testUpdateCoins(2, 100)) {
    printf("Error testing updateCoins()\n");
    errorCount++;
  }

  printf("\nUNIT TEST 1 COMPLETE with %d ERRORS\n\n", errorCount);

  return 0;

}
コード例 #2
0
ファイル: unittest4.c プロジェクト: cr8zd/cs362w16
int main () {
    struct gameState G1;
    int p;
    int coins;
   
    printf("Testing Function: GetCost\n");
    
    //SelectStream(2);
    //PutSeed(3);
    
    for (int n = 0; n < 2000; n++) {
        for (int i = 0; i < sizeof(struct gameState); i++) {
            ((char*)&G1)[i] = floor(Random() * 256);
        }
        coins = 0;
        p = floor(Random() * MAX_PLAYERS);
        G1.deckCount[p] = floor(Random() * MAX_DECK);
        G1.discardCount[p] = floor(Random() * MAX_DECK);
        G1.handCount[p] = floor(Random() * MAX_HAND);
        
        testUpdateCoins(p, &G1, coins);
    }
    
    printf("Testing Success!\n");
    
    return 0;
}
コード例 #3
0
int main(){
	testUpdateCoins();
	return 0;
}