C-ifying project.

This commit is contained in:
Murilo Pereira
2011-05-31 03:03:13 -03:00
parent 57a38c7152
commit 1c63b767f6
38 changed files with 47 additions and 49 deletions
+33 -33
View File
@@ -2,41 +2,41 @@ CC = gcc
CFLAGS = -W -Wall -pedantic -ansi -std=c99 -g CFLAGS = -W -Wall -pedantic -ansi -std=c99 -g
LDFLAGS = -lncursesw LDFLAGS = -lncursesw
EXECUTABLE = bin/ttysolitaire EXECUTABLE = ttysolitaire
LIB_DIR = lib SRC_DIR = src
SRC = ${LIB_DIR}/ttysolitaire.c SRC = ${SRC_DIR}/ttysolitaire.c
LIB_OBJECTS = ${LIB_DIR}/common.o \ SRC_OBJECTS = ${SRC_DIR}/common.o \
${LIB_DIR}/frame.o \ ${SRC_DIR}/frame.o \
${LIB_DIR}/card.o \ ${SRC_DIR}/card.o \
${LIB_DIR}/stack.o \ ${SRC_DIR}/stack.o \
${LIB_DIR}/deck.o \ ${SRC_DIR}/deck.o \
${LIB_DIR}/curses.o \ ${SRC_DIR}/curses.o \
${LIB_DIR}/cursor.o \ ${SRC_DIR}/cursor.o \
${LIB_DIR}/keyboard.o \ ${SRC_DIR}/keyboard.o \
${LIB_DIR}/display.o \ ${SRC_DIR}/display.o \
${LIB_DIR}/game.o \ ${SRC_DIR}/game.o \
TEST_EXECUTABLE = bin/ttysolitaire_test TESTS_EXECUTABLE = ttysolitaire_test
TEST_DIR = test TESTS_DIR = tests
TEST_SRC = ${TEST_DIR}/ttysolitaire_test.c TESTS_SRC = ${TESTS_DIR}/ttysolitaire_test.c
TEST_OBJECTS = ${TEST_DIR}/frame_test.o \ TESTS_OBJECTS = ${TESTS_DIR}/frame_test.o \
${TEST_DIR}/card_test.o \ ${TESTS_DIR}/card_test.o \
${TEST_DIR}/stack_test.o \ ${TESTS_DIR}/stack_test.o \
${TEST_DIR}/deck_test.o \ ${TESTS_DIR}/deck_test.o \
${TEST_DIR}/curses_test.o \ ${TESTS_DIR}/curses_test.o \
${TEST_DIR}/cursor_test.o \ ${TESTS_DIR}/cursor_test.o \
${TEST_DIR}/keyboard_test.o \ ${TESTS_DIR}/keyboard_test.o \
${TEST_DIR}/display_test.o \ ${TESTS_DIR}/display_test.o \
${TEST_DIR}/game_test.o \ ${TESTS_DIR}/game_test.o \
${TEST_DIR}/test_helper.o \ ${TESTS_DIR}/test_helper.o \
${TEST_DIR}/test_helper_test.o \ ${TESTS_DIR}/test_helper_test.o \
ttysolitaire: ${LIB_OBJECTS} ttysolitaire: ${SRC_OBJECTS}
${CC} ${CFLAGS} ${LDFLAGS} ${SRC} -o ${EXECUTABLE} ${LIB_OBJECTS} ${CC} ${CFLAGS} ${LDFLAGS} ${SRC} -o ${EXECUTABLE} ${SRC_OBJECTS}
test: ${LIB_OBJECTS} ${TEST_OBJECTS} test: ${SRC_OBJECTS} ${TESTS_OBJECTS}
@${CC} ${CFLAGS} ${LDFLAGS} ${TEST_SRC} -o ${TEST_EXECUTABLE} ${TEST_OBJECTS} ${LIB_OBJECTS} @${CC} ${CFLAGS} ${LDFLAGS} ${TESTS_SRC} -o ${TESTS_EXECUTABLE} ${TESTS_OBJECTS} ${SRC_OBJECTS}
@${TEST_EXECUTABLE} @./${TESTS_EXECUTABLE}
clean: clean:
rm -rf {${LIB_DIR},${TEST_DIR}}/*.o ${EXECUTABLE} ${TEST_EXECUTABLE} rm -rf {${SRC_DIR},${TESTS_DIR}}/*.o ${EXECUTABLE} ${TESTS_EXECUTABLE}
+1 -1
View File
@@ -9,7 +9,7 @@
#+BEGIN_SRC #+BEGIN_SRC
$ git clone git://github.com/mpereira/tty-solitaire.git $ git clone git://github.com/mpereira/tty-solitaire.git
$ cd tty-solitaire $ cd tty-solitaire
$ make && bin/ttysolitaire $ make && ttysolitaire
#+END_SRC #+END_SRC
** Run the unit tests ** Run the unit tests
-2
View File
@@ -1,2 +0,0 @@
*
!.gitignore
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
+1 -1
View File
@@ -1,6 +1,6 @@
#include <assert.h> #include <assert.h>
#include "test_helper.h" #include "test_helper.h"
#include "../lib/card.h" #include "../src/card.h"
void test_initialize_card() { void test_initialize_card() {
struct card *card; struct card *card;
+1 -1
View File
@@ -1,6 +1,6 @@
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include "../lib/curses.h" #include "../src/curses.h"
void test_curses() { void test_curses() {
assert(true); assert(true);
+1 -1
View File
@@ -1,6 +1,6 @@
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include "../lib/cursor.h" #include "../src/cursor.h"
void test_cursor() { void test_cursor() {
assert(true); assert(true);
+1 -1
View File
@@ -1,6 +1,6 @@
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include "../lib/deck.h" #include "../src/deck.h"
void test_deck() { void test_deck() {
assert(true); assert(true);
+1 -1
View File
@@ -1,6 +1,6 @@
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include "../lib/display.h" #include "../src/display.h"
void test_display() { void test_display() {
assert(true); assert(true);
+1 -1
View File
@@ -1,6 +1,6 @@
#include <assert.h> #include <assert.h>
#include "test_helper.h" #include "test_helper.h"
#include "../lib/frame.h" #include "../src/frame.h"
void test_initialize_frame() { void test_initialize_frame() {
struct frame *frame; struct frame *frame;
+2 -2
View File
@@ -1,6 +1,6 @@
#include <assert.h> #include <assert.h>
#include "../lib/stack.h" #include "../src/stack.h"
#include "../lib/game.h" #include "../src/game.h"
#include "test_helper.h" #include "test_helper.h"
void test_valid_move_from_stock_to_stock() { void test_valid_move_from_stock_to_stock() {
@@ -1,6 +1,6 @@
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include "../lib/keyboard.h" #include "../src/keyboard.h"
void test_keyboard() { void test_keyboard() {
assert(true); assert(true);
+1 -1
View File
@@ -1,6 +1,6 @@
#include <assert.h> #include <assert.h>
#include "test_helper.h" #include "test_helper.h"
#include "../lib/stack.h" #include "../src/stack.h"
void test_initialize_stack() { void test_initialize_stack() {
struct stack *stack; struct stack *stack;
+3 -3
View File
@@ -2,9 +2,9 @@
#define TEST_HELPER_H #define TEST_HELPER_H
#include <stdbool.h> #include <stdbool.h>
#include "../lib/frame.h" #include "../src/frame.h"
#include "../lib/card.h" #include "../src/card.h"
#include "../lib/stack.h" #include "../src/stack.h"
bool frames_equal(struct frame *, struct frame *); bool frames_equal(struct frame *, struct frame *);
bool cards_equal(struct card *, struct card *); bool cards_equal(struct card *, struct card *);