Fix make test (Issue #14)

This commit is contained in:
flamin 2019-01-20 20:31:35 -05:00
parent 57c481f506
commit 69bf25f87e

View File

@ -119,7 +119,7 @@ void test_valid_move_from_waste_pile_to_foundation_stacks() {
stack_malloc(&waste_pile);
stack_init(waste_pile);
card_set(waste_pile->card, ACE, SPADES, EXPOSED, WASTE_PILE_BEGIN_Y, WASTE_PILE_BEGIN_X);
card_set(waste_pile->card, TWO, SPADES, EXPOSED, WASTE_PILE_BEGIN_Y, WASTE_PILE_BEGIN_X);
for (int i = 0; i < 4; i++) {
stack_malloc(&foundation_stacks[i]);
stack_init(foundation_stacks[i]);
@ -129,7 +129,6 @@ void test_valid_move_from_waste_pile_to_foundation_stacks() {
card_set(foundation_stacks[2]->card, ACE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_2_BEGIN_X);
card_set(foundation_stacks[3]->card, ACE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_3_BEGIN_X);
for (int i = 0; i < 4; i++) {
// TODO: fix error here
assert(valid_move(waste_pile, foundation_stacks[i]));
}
stack_free(waste_pile);
@ -143,20 +142,19 @@ void test_valid_move_from_waste_pile_to_maneuvre_stacks() {
stack_malloc(&waste_pile);
stack_init(waste_pile);
card_set(waste_pile->card, ACE, SPADES, EXPOSED, WASTE_PILE_BEGIN_Y, WASTE_PILE_BEGIN_X);
card_set(waste_pile->card, ACE, DIAMONDS, EXPOSED, WASTE_PILE_BEGIN_Y, WASTE_PILE_BEGIN_X);
for (int i = 0; i < 7; i++) {
stack_malloc(&maneuvre_stacks[i]);
stack_init(maneuvre_stacks[i]);
}
card_set(maneuvre_stacks[0]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_0_BEGIN_X);
card_set(maneuvre_stacks[1]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_1_BEGIN_X);
card_set(maneuvre_stacks[2]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_2_BEGIN_X);
card_set(maneuvre_stacks[3]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_3_BEGIN_X);
card_set(maneuvre_stacks[4]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_4_BEGIN_X);
card_set(maneuvre_stacks[5]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_5_BEGIN_X);
card_set(maneuvre_stacks[6]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_6_BEGIN_X);
card_set(maneuvre_stacks[0]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_0_BEGIN_X);
card_set(maneuvre_stacks[1]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_1_BEGIN_X);
card_set(maneuvre_stacks[2]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_2_BEGIN_X);
card_set(maneuvre_stacks[3]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_3_BEGIN_X);
card_set(maneuvre_stacks[4]->card, TWO, CLUBS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_4_BEGIN_X);
card_set(maneuvre_stacks[5]->card, TWO, CLUBS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_5_BEGIN_X);
card_set(maneuvre_stacks[6]->card, TWO, CLUBS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_6_BEGIN_X);
for (int i = 0; i < 7; i++) {
// TODO: fix error here
assert(valid_move(waste_pile, maneuvre_stacks[i]));
}
stack_free(waste_pile);
@ -219,15 +217,14 @@ void test_valid_move_from_foundation_stack_to_foundation_stacks() {
stack_init(foundation_stacks[i]);
}
card_set(foundation_stacks[0]->card, ACE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_0_BEGIN_X);
card_set(foundation_stacks[1]->card, ACE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_1_BEGIN_X);
card_set(foundation_stacks[2]->card, ACE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_2_BEGIN_X);
card_set(foundation_stacks[3]->card, ACE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_3_BEGIN_X);
card_set(foundation_stacks[1]->card, TWO, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_1_BEGIN_X);
card_set(foundation_stacks[2]->card, THREE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_2_BEGIN_X);
card_set(foundation_stacks[3]->card, FOUR, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_3_BEGIN_X);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (i == j) {
if (i != j + 1) {
assert(!valid_move(foundation_stacks[i], foundation_stacks[j]));
} else {
// TODO: fix error here
assert(valid_move(foundation_stacks[i], foundation_stacks[j]));
}
}
@ -247,22 +244,21 @@ void test_valid_move_from_foundation_stack_to_maneuvre_stacks() {
}
card_set(foundation_stacks[0]->card, ACE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_0_BEGIN_X);
card_set(foundation_stacks[1]->card, ACE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_1_BEGIN_X);
card_set(foundation_stacks[2]->card, ACE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_2_BEGIN_X);
card_set(foundation_stacks[3]->card, ACE, SPADES, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_3_BEGIN_X);
card_set(foundation_stacks[2]->card, ACE, CLUBS, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_2_BEGIN_X);
card_set(foundation_stacks[3]->card, ACE, CLUBS, EXPOSED, FOUNDATION_BEGIN_Y, FOUNDATION_3_BEGIN_X);
for (int i = 0; i < 7; i++) {
stack_malloc(&maneuvre_stacks[i]);
stack_init(maneuvre_stacks[i]);
}
card_set(maneuvre_stacks[0]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_0_BEGIN_X);
card_set(maneuvre_stacks[1]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_1_BEGIN_X);
card_set(maneuvre_stacks[2]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_2_BEGIN_X);
card_set(maneuvre_stacks[3]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_3_BEGIN_X);
card_set(maneuvre_stacks[4]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_4_BEGIN_X);
card_set(maneuvre_stacks[5]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_5_BEGIN_X);
card_set(maneuvre_stacks[6]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_6_BEGIN_X);
card_set(maneuvre_stacks[0]->card, TWO, HEARTS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_0_BEGIN_X);
card_set(maneuvre_stacks[1]->card, TWO, HEARTS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_1_BEGIN_X);
card_set(maneuvre_stacks[2]->card, TWO, HEARTS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_2_BEGIN_X);
card_set(maneuvre_stacks[3]->card, TWO, HEARTS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_3_BEGIN_X);
card_set(maneuvre_stacks[4]->card, TWO, DIAMONDS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_4_BEGIN_X);
card_set(maneuvre_stacks[5]->card, TWO, DIAMONDS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_5_BEGIN_X);
card_set(maneuvre_stacks[6]->card, TWO, DIAMONDS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_6_BEGIN_X);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 7; j++) {
// TODO: fix error here
assert(valid_move(foundation_stacks[i], maneuvre_stacks[j]));
}
}
@ -342,16 +338,15 @@ void test_valid_move_from_maneuvre_stack_to_foundation_stacks() {
stack_malloc(&maneuvre_stacks[i]);
stack_init(maneuvre_stacks[i]);
}
card_set(maneuvre_stacks[0]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_0_BEGIN_X);
card_set(maneuvre_stacks[1]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_1_BEGIN_X);
card_set(maneuvre_stacks[2]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_2_BEGIN_X);
card_set(maneuvre_stacks[3]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_3_BEGIN_X);
card_set(maneuvre_stacks[4]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_4_BEGIN_X);
card_set(maneuvre_stacks[5]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_5_BEGIN_X);
card_set(maneuvre_stacks[6]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_6_BEGIN_X);
card_set(maneuvre_stacks[0]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_0_BEGIN_X);
card_set(maneuvre_stacks[1]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_1_BEGIN_X);
card_set(maneuvre_stacks[2]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_2_BEGIN_X);
card_set(maneuvre_stacks[3]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_3_BEGIN_X);
card_set(maneuvre_stacks[4]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_4_BEGIN_X);
card_set(maneuvre_stacks[5]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_5_BEGIN_X);
card_set(maneuvre_stacks[6]->card, TWO, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_6_BEGIN_X);
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 4; j++) {
// TODO: fix error here
assert(valid_move(maneuvre_stacks[i], foundation_stacks[j]));
}
}
@ -371,18 +366,17 @@ void test_valid_move_from_maneuvre_stack_to_maneuvre_stacks() {
stack_init(maneuvre_stacks[i]);
}
card_set(maneuvre_stacks[0]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_0_BEGIN_X);
card_set(maneuvre_stacks[1]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_1_BEGIN_X);
card_set(maneuvre_stacks[2]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_2_BEGIN_X);
card_set(maneuvre_stacks[3]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_3_BEGIN_X);
card_set(maneuvre_stacks[4]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_4_BEGIN_X);
card_set(maneuvre_stacks[5]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_5_BEGIN_X);
card_set(maneuvre_stacks[6]->card, ACE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_6_BEGIN_X);
card_set(maneuvre_stacks[1]->card, TWO, HEARTS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_1_BEGIN_X);
card_set(maneuvre_stacks[2]->card, THREE, CLUBS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_2_BEGIN_X);
card_set(maneuvre_stacks[3]->card, FOUR, DIAMONDS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_3_BEGIN_X);
card_set(maneuvre_stacks[4]->card, FIVE, SPADES, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_4_BEGIN_X);
card_set(maneuvre_stacks[5]->card, SIX, DIAMONDS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_5_BEGIN_X);
card_set(maneuvre_stacks[6]->card, SEVEN, CLUBS, EXPOSED, MANEUVRE_BEGIN_Y, MANEUVRE_6_BEGIN_X);
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 7; j++) {
if (i == j) {
if (i + 1 != j) {
assert(!valid_move(maneuvre_stacks[i], maneuvre_stacks[j]));
} else {
// TODO: fix error here
assert(valid_move(maneuvre_stacks[i], maneuvre_stacks[j]));
}
}