add rudimentary unit tests, and logging timestamps

Signed-off-by: Aidan Hahn <aidan@aidanis.online>
This commit is contained in:
Aidan Hahn 2022-02-28 01:09:33 -08:00
parent 7fafcd344d
commit 1e9b701542
No known key found for this signature in database
GPG key ID: 327711E983899316
6 changed files with 188 additions and 37 deletions

12
tests/tests.mk Normal file
View file

@ -0,0 +1,12 @@
ALOG_TEST_SRCS = $(shell find tests -iname "*.c" -exec basename {} \;)
ALOG_TESTS = $(ALOG_TEST_SRCS:.c=)
$(ALOG_TESTS): $(ALOG_LIB)
$(CC) $(CFLAGS) -g -o $(BUILD_DIR)/$@.o -c tests/$@.c
$(CC) -o $(TARGET_DIR)/$@ $(BUILD_DIR)/$@.o $(ALOG_LIB)
chmod +x $(TARGET_DIR)/$@
run-tests: $(ALOG_TESTS)
for test in $^ ; do \
$(TARGET_DIR)/$$test ; \
done