40 lines
792 B
C
40 lines
792 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(compilation_and_invocation) {
|
|
struct chessboard c = {.C = 10, .R = 10 };
|
|
struct piece_position p;
|
|
|
|
p.piece = PAWN;
|
|
p.column = 0;
|
|
p.row = 0;
|
|
increasing_path_len(&c, &p);
|
|
decreasing_path_len(&c, &p);
|
|
simple_path_len(&c, &p);
|
|
TEST_PASSED;
|
|
}
|
|
|
|
int main() {
|
|
RUN_TEST(compilation_and_invocation);
|
|
PRINT_TEST_RESULTS;
|
|
assert(ALL_TESTS_PASSED);
|
|
}
|