-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first extremely rough attempt at adding CI support
- Loading branch information
1 parent
a58272c
commit 0198857
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*.o | ||
*.d | ||
*.a | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
CC := clang | ||
|
||
SOURCES := $(wildcard src/*.c) | ||
|
||
CINCLUDES := -I/usr/include -Ibuild/deps/tinker/include -Ibuild/deps/ali/include/ -Iinclude | ||
|
||
override CFLAGS += -std=c11 -pedantic-errors \ | ||
-fdiagnostics-show-option -Werror -Weverything \ | ||
-Wno-cast-qual -Wno-missing-prototypes -Wno-vla | ||
|
||
all: build/dmm-test | ||
|
||
build-deps: | ||
mkdir -p build/deps/ | ||
cd build/deps; test -d tinker || git clone https://github.com/awooos/tinker.git | ||
cd build/deps; test -d ali || git clone https://github.com/awooos/ali.git | ||
cd build/deps/tinker; git pull | ||
cd build/deps/ali; git checkout .; git pull | ||
cd build/deps/ali/include; rm std*.h | ||
|
||
build/dmm-test: $(SOURCES) | ||
$(MAKE) build-deps | ||
${CC} ${CFLAGS} ${CINCLUDES} test/strrev.c $^ build/deps/tinker/src/main.c build/deps/ali/src/number/main.c test/main.c -o $@ | ||
|
||
test: build/dmm-test | ||
./build/dmm-test | ||
|
||
clean: | ||
rm -rf build | ||
|
||
.PHONY: all clean test build-deps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <stdio.h> | ||
#include <tinker.h> | ||
|
||
void add_dmm_tests(void); | ||
|
||
char *shitty_print(const char *str) { | ||
size_t len = strlen(str); | ||
|
||
for (size_t idx = 0; idx < len; idx++) { | ||
putchar(str[idx]); | ||
} | ||
return (char*)str; | ||
} | ||
|
||
int main(void) | ||
{ | ||
add_dmm_tests(); | ||
|
||
if (!tinker_run_tests(&shitty_print)) { | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
// copypasta'd from ali for simplicity. | ||
char *strrev(char *str) | ||
{ | ||
size_t length = strlen(str); | ||
size_t half_length = length / 2; | ||
|
||
for (size_t idx = 0; idx < half_length; idx++) { | ||
char tmp = str[idx]; | ||
str[idx] = str[length - idx - 1]; | ||
str[length - idx - 1] = tmp; | ||
} | ||
|
||
return str; | ||
} | ||
|