Created
September 16, 2015 09:15
-
-
Save mogelbrod/6f74e77b4f6e68dc1c50 to your computer and use it in GitHub Desktop.
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
NAME = main | |
_DEPS = | |
_OBJ = $(NAME).o | |
SDIR = . | |
ODIR = . | |
CC = gcc | |
CFLAGS = -std=c99 -O2 -W -g -I. | |
CXX = g++ | |
CXXFLAGS = -std=c++0x -O2 -W -Wno-unused-result -g -I. | |
DEPS = $(patsubst %,$(SDIR)/%,$(_DEPS)) | |
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) | |
$(ODIR)/%.o: $(SDIR)/%.c init $(DEPS) | |
$(CXX) $(CXXFLAGS) -c -o $@ $< | |
$(NAME): $(OBJ) | |
$(CXX) $(CXXFLAGS) -o $@ $^ | |
.PHONY: clean | |
init: | |
mkdir -p $(ODIR) | |
test: $(NAME) | |
./run-tests $(NAME) | |
full: clean $(NAME) | |
clean: | |
rm -f $(ODIR)/*.o | |
rm -f $(NAME).exe |
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
#!/bin/bash | |
name=$1 | |
if [ "x$name" = "x" ] ; then | |
name="main" | |
fi | |
if [ "$TERM" = "cygwin" ] ; then | |
name="${name}.exe" | |
fi | |
cd tests | |
echo path: `pwd` | |
echo executable: $name | |
for o in $(find . -name '*.ans'); do | |
o=${o#./} | |
echo "${o%.out} ===================================================" | |
../$name < ${o%.ans}.in > ${o%.ans}.out && diff $o ${o%.ans}.out | |
[ "$?" = 0 ] && echo "=> OK" | |
done | |
echo "==========================================================" |
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
mkdir tests | |
mv test-case-a.input tests/a.in | |
mv test-case-a.answer tests/a.ans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment