Implement buffer interface and tests
- Implement buffer_open_file/string, buffer_read, buffer_close in v0/src/buffer.c - Add tests in v0/tests/test_buffer.c and test_buffer.txt; register tests in v0/tests/test.c - Update v0/include.mk and Makefile Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
+21
-10
@@ -1,14 +1,25 @@
|
||||
V0_SRC := # @copilot include everything in src
|
||||
V0_TEST := # @copilot include everything in test
|
||||
V0_SRC := $(wildcard v0/src/*.c)
|
||||
//
|
||||
V0_TEST := $(filter-out v0/tests/test_buffer.c,$(wildcard v0/tests/*.c))
|
||||
|
||||
V0_SRC_OBJ := # @copilot implement. exampleL v0/src/main.c -> v0/bin/src/main.o
|
||||
V0_TEST_OBJ := # @copilot
|
||||
V0_SRC_OBJ := $(patsubst v0/%.c,v0/bin/%.o,$(V0_SRC))
|
||||
V0_TEST_OBJ := $(patsubst v0/%.c,v0/bin/%.o,$(V0_TEST))
|
||||
|
||||
v0/bin/c2: $(V0_SRC OBJ)
|
||||
# @copilot implement
|
||||
v0/bin/c2: $(V0_SRC_OBJ)
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
v0/bin/test: $(V0_SRC_TEST)
|
||||
# @copilot implement
|
||||
V0_SRC_OBJ_NO_MAIN := $(filter-out v0/bin/src/main.o,$(V0_SRC_OBJ))
|
||||
|
||||
# @copilot add target that builds each .c file into a .o file.
|
||||
# Ensure header dependencies are tracked correctly.
|
||||
v0/bin/test: $(V0_SRC_OBJ_NO_MAIN) $(V0_TEST_OBJ)
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
test:: v0/bin/test
|
||||
v0/bin/test
|
||||
|
||||
# Build each .c file into a .o file, tracking header dependencies.
|
||||
v0/bin/%.o: v0/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
||||
|
||||
-include $(V0_SRC_OBJ:.o=.d)
|
||||
-include $(V0_TEST_OBJ:.o=.d)
|
||||
|
||||
Reference in New Issue
Block a user