40 lines
799 B
C
40 lines
799 B
C
#include <assert.h>
|
|
|
|
#include "basic_testing.h"
|
|
|
|
#include "../chess_paths.h"
|
|
|
|
struct chessboard {
|
|
unsigned int C;
|
|
unsigned int R;
|
|
};
|
|
|
|
int value_at(const struct chessboard * c, unsigned int column, unsigned int row) {
|
|
return column + row * c->C;
|
|
}
|
|
|
|
unsigned int columns(const struct chessboard * c) {
|
|
return c->C;
|
|
}
|
|
|
|
unsigned int rows(const struct chessboard * c) {
|
|
return c->R;
|
|
};
|
|
|
|
TEST(simple_pawn) {
|
|
struct chessboard c = { .C = 10000, .R = 40000 };
|
|
struct piece_position p;
|
|
p.piece = PAWN;
|
|
p.column = 9999;
|
|
p.row = 0;
|
|
assert_uint_eq(simple_path_len(&c, &p), 39999);
|
|
assert_uint_eq(p.column, 9999);
|
|
assert_uint_eq(p.row, 39999);
|
|
TEST_PASSED;
|
|
}
|
|
|
|
int main() {
|
|
RUN_TEST(simple_pawn);
|
|
PRINT_TEST_RESULTS;
|
|
assert(ALL_TESTS_PASSED);
|
|
}
|