Example #1
0
void
test_card_to_string(void)
{
  cut_set_message("カードを文字列にする");
  {
    Card sa = card_new(SPADE,ACE);

    cut_assert(strcmp(card_to_string(sa), "SA")==0);
  }
}
Example #2
0
void
test_card_new(void)
{
   cut_set_message("スーツと番号からカードを作成");
  {
    Card sa = card_new(SPADE,ACE);
    cut_assert(card_suit(sa)==SPADE);
    cut_assert(card_no(sa)==ACE);
  }
}
Example #3
0
Card card_new_with_values (uint value, char seed) {
	Card ret = card_new ();
	if (value < 1 || value > 13)
		value = 1;

	if (!__check_seed (seed))
		seed = SPADES;

	ret->value = value;
	ret->seed = seed;

	return ret;
}
Example #4
0
Card card_new_random () {
	Card ret = card_new ();
	
	ret->value = (rand () % 13) + 1;

	switch (rand () % 4) {
		case 0:
			ret->seed = SPADES;
			break;
		case 1:
			ret->seed = DIAMONDS;
			break;
		case 2:
			ret->seed = CLUBS;
			break;
		case 3:
			ret->seed = HEARTS;
			break;
	}

	return ret;
}