diff --git a/c-check/Makefile b/c-check/Makefile index 1cc056b7..dabcf6b1 100644 --- a/c-check/Makefile +++ b/c-check/Makefile @@ -11,13 +11,17 @@ CFLAGS = `pkg-config --cflags check` -g --std=c99 -D_POSIX_C_SOURCE=200809L LIBS = `pkg-config --libs check` -# All files that should be part of your test should start with 'test' -TEST_SRC = $(wildcard test*.[c\|h]) +# All files that should be part of your test should start with 'test_' +TEST_SRC = $(wildcard test_*.c) TEST_BASE = $(basename ${TEST_SRC}) TEST_OBJECTS = $(addsuffix .o, ${TEST_BASE}) -# If you add more implementation classes, add them to this variable -OBJECT_UNDER_TEST = GildedRose.o +# All files that should be part of your main program should start with 'gilded_' +PROG_SRC = $(wildcard gilded_*.c) +PROG_BASE = $(basename ${PROG_SRC}) +PROG_OBJECTS = $(addsuffix .o, ${PROG_BASE}) + +OBJECT_UNDER_TEST = GildedRose.o ${PROG_OBJECTS} # This is the test application. You can run this program to see your test output TEST_APP = test_gildedrose diff --git a/c-check/README b/c-check/README.md similarity index 54% rename from c-check/README rename to c-check/README.md index afb21a4e..ec2cd02e 100644 --- a/c-check/README +++ b/c-check/README.md @@ -1,13 +1,33 @@ +# Gilded Rose, C99 Edition + The command "make" will build and run your tests, as well as build the program golden_rose, which can serve as the basis for a golden-rule test. -Assumptions: +## Assumptions - gnu make and a C compiler (like gcc) is installed on your system and is in the PATH - The check unit testing library is installed on your system (https://libcheck.github.io/check/) - pkg-config is installed on your system -Notes: +## Usage + - Run `make` to build the program and run all tests + - Files which contain tests should be named `test_*.c` They will automatically + be included in your test suite. + - `GildedRose.h` should not be modified. The Goblin threat is real. + - New program logic may be included in files named `gilded_*.c` which will + automatically be included in both your tests and the final program. + +## Golden Rule tests + - The program `golden_rose` will generate text output. If you capture this + output after your first `make` you can use this as a reference for a golden + rule test. + - You can test your work against this reference by directing the output of your + current golden_rose to a file and using the `diff` utility to compare that + to the reference file you created above. + - To avoid the Goblin threat you can use `git diff GildedRose.h`, which should + have no output if you have left the precious Item structure unchanged. + +## Notes - This project is tweaked to run on Linux systems, and will mostly work on Macs. With some changes to the Makefile it can be made to run on BSD systems with BSD make. An adventurous person could also get it to run on Windows.