-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
177 lines (139 loc) · 5.37 KB
/
Makefile
File metadata and controls
177 lines (139 loc) · 5.37 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
PYTHON = .venv/bin/python
PYTEST = .venv/bin/pytest
# Convenience short aliases
RUN_ALIASES = run-bst run-deque run-dict run-dll run-graph run-heap \
run-list run-networkx run-queue run-set run-sll run-stack run-trie
TEST_ALIASES = test-bst test-deque test-dict test-dll test-graph test-heap \
test-list test-networkx test-queue test-set test-sll test-stack test-stack-app \
test-queue-app test-deque-app test-list-app test-sll-app test-dll-app test-trie \
test-uint
.PHONY: install test $(RUN_ALIASES) $(TEST_ALIASES) \
run-stack-app run-queue-app run-deque-app run-list-app run-sll-app run-dll-app run-uint-app \
demo-all \
demo-stack demo-stack-dark demo-stack-light \
demo-queue demo-queue-dark demo-queue-light \
demo-deque demo-deque-dark demo-deque-light \
demo-list demo-list-dark demo-list-light \
demo-sll demo-sll-dark demo-sll-light \
demo-dll demo-dll-dark demo-dll-light \
demo-uint demo-uint-dark demo-uint-light
# Create the virtual environment
.venv:
python3 -m venv .venv
# Install dependencies into the venv
install: .venv
$(PYTHON) -m pip install -r requirements.txt
# Run all tests
test:
$(PYTEST) tests/
# Short aliases — non-TUI demos
run-bst: run-binary_search_tree_demo
run-deque: run-deque_demo
run-dict: run-dictionary_demo
run-dll: run-doubly_linked_list
run-graph: run-graph_demo
run-heap: run-heap_demo
run-list: run-list_demo
run-networkx: run-networkx_graph_demo
run-queue: run-queue_demo
run-set: run-set_demo
run-sll: run-singly_linked_list
run-stack: run-stack_demo
run-trie: run-trie_demo
# App run targets (data_structures.tui.*)
run-stack-app:
$(PYTHON) -m data_structures.tui.stack_app
run-queue-app:
$(PYTHON) -m data_structures.tui.queue_app
run-deque-app:
$(PYTHON) -m data_structures.tui.deque_app
run-list-app:
$(PYTHON) -m data_structures.tui.list_app
run-sll-app:
$(PYTHON) -m data_structures.tui.singly_linked_list_app
run-dll-app:
$(PYTHON) -m data_structures.tui.doubly_linked_list_app
run-uint-app:
$(PYTHON) -m data_structures.tui.unsigned_int_app
# Test aliases
test-bst: test-binary_search_tree_demo
test-deque: test-deque_demo
test-dict: test-dictionary_demo
test-dll: test-doubly_linked_list
test-graph: test-graph_demo
test-heap: test-heap_demo
test-list: test-list_demo
test-networkx: test-networkx_graph_demo
test-queue: test-queue_demo
test-queue-app: test-queue_app
test-set: test-set_demo
test-sll: test-singly_linked_list
test-sll-app: test-singly_linked_list_app
test-stack: test-stack_demo
test-stack-app: test-stack_app
test-deque-app: test-deque_app
test-list-app: test-list_app
test-dll-app: test-doubly_linked_list_app
test-uint: test-unsigned_int
test-trie: test-trie_demo
# Demo videos (requires vhs: https://github.com/charmbracelet/vhs)
demo-stack-dark:
$(PYTHON) scripts/run_vhs.py demos/stack.tape --mode dark
demo-stack-light:
$(PYTHON) scripts/run_vhs.py demos/stack.tape --mode light
demo-stack: demo-stack-dark demo-stack-light
demo-queue-dark:
$(PYTHON) scripts/run_vhs.py demos/queue.tape --mode dark
demo-queue-light:
$(PYTHON) scripts/run_vhs.py demos/queue.tape --mode light
demo-queue: demo-queue-dark demo-queue-light
demo-deque-dark:
$(PYTHON) scripts/run_vhs.py demos/deque.tape --mode dark
demo-deque-light:
$(PYTHON) scripts/run_vhs.py demos/deque.tape --mode light
demo-deque: demo-deque-dark demo-deque-light
demo-list-dark:
$(PYTHON) scripts/run_vhs.py demos/list.tape --mode dark
demo-list-light:
$(PYTHON) scripts/run_vhs.py demos/list.tape --mode light
demo-list: demo-list-dark demo-list-light
demo-sll-dark:
$(PYTHON) scripts/run_vhs.py demos/sll.tape --mode dark
demo-sll-light:
$(PYTHON) scripts/run_vhs.py demos/sll.tape --mode light
demo-sll: demo-sll-dark demo-sll-light
demo-dll-dark:
$(PYTHON) scripts/run_vhs.py demos/dll.tape --mode dark
demo-dll-light:
$(PYTHON) scripts/run_vhs.py demos/dll.tape --mode light
demo-dll: demo-dll-dark demo-dll-light
demo-uint-dark:
$(PYTHON) scripts/run_vhs.py demos/unsigned-int.tape --mode dark
demo-uint-light:
$(PYTHON) scripts/run_vhs.py demos/unsigned-int.tape --mode light
demo-uint: demo-uint-dark demo-uint-light
demo-all: demo-stack demo-queue demo-deque demo-list demo-sll demo-dll demo-uint
# Run a single non-TUI demo module: make run-<name>
# Note: demo files contain only class definitions (no __main__),
# so these targets verify clean import but produce no output.
#
# Valid names:
# binary_search_tree_demo deque_demo dictionary_demo
# doubly_linked_list graph_demo heap_demo
# list_demo networkx_graph_demo queue_demo
# set_demo singly_linked_list stack_demo
# trie_demo
run-%:
$(PYTHON) -m data_structures.$*
# Run a single test module: make test-<name>
#
# Valid names (same list as above, plus app variants):
# binary_search_tree_demo deque_demo dictionary_demo
# doubly_linked_list graph_demo heap_demo
# list_demo networkx_graph_demo queue_demo
# queue_app deque_app list_app
# singly_linked_list singly_linked_list_app
# doubly_linked_list_app set_demo stack_demo
# stack_app trie_demo
test-%:
$(PYTEST) tests/test_$*.py -v