-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (57 loc) · 2.32 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Author: Elijah Opoku-Nyarko and Jake Colbert
# define colors
ifneq (,$(findstring xterm,${TERM}))
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
RESET := $(shell tput -Txterm sgr0)
else
RED := ""
GREEN := ""
RESET := ""
endif
# default target
all: project5
# compile the code into an executable called 'project5' using C++ 2011
project5: project5.cc province.cc province.h
g++ -std=c++11 -o project5 project5.cc province.cc
# test all the code
test-all: project5 test-requirement1 test-nowhere test-one-road test-simple test-local test-combo
@rm test.diff && rm test-data/project5.out
test-requirement1: project5
./project5 < test-data/requirement1.in > test-data/project5.out
-@diff test-data/project5.out test-data/requirement1.out > test.diff && echo "$(GREEN)Passed!$(RESET)"
# test the code against an expected output file
test-nowhere: project5
@echo ""
@echo "$(RED)--- Nowhere Test ---$(RESET)"
@echo ""
./project5 < test-data/t01-nowhere.in > test-data/project5.out
-@diff test-data/project5.out test-data/t01-nowhere.out > test.diff && echo "$(GREEN)Passed!$(RESET)"
# test the code against an expected output file
test-one-road: project5
@echo ""
@echo "$(RED)--- One Road Test ---$(RESET)"
@echo ""
./project5 < test-data/t02-one-road.in > test-data/project5.out
-@diff test-data/project5.out test-data/t02-one-road.out > test.diff && echo "$(GREEN)Passed!$(RESET)"
# test the code against an expected output file
test-simple: project5
@echo ""
@echo "$(RED)--- Simple Test ---$(RESET)"
@echo ""
./project5 < test-data/t03-simple.in > test-data/project5.out
-@diff test-data/project5.out test-data/t03-simple.out > test.diff && echo "$(GREEN)Passed!$(RESET)"
# test the code against an expected output file
test-local: project5
@echo ""
@echo "$(RED)--- Local Test ---$(RESET)"
@echo ""
./project5 < test-data/t08-local.in > test-data/project5.out
-@diff test-data/project5.out test-data/t08-local.out > test.diff && echo "$(GREEN)Passed!$(RESET)"
# test the code against an expected output file
test-combo: project5
@echo ""
@echo "$(RED)--- Combo Test ---$(RESET)"
@echo ""
./project5 < test-data/t0502-combo.in > test-data/project5.out
-@diff test-data/project5.out test-data/t0502-combo.out > test.diff && echo "$(GREEN)Passed!$(RESET)"