25 lines
546 B
Makefile
25 lines
546 B
Makefile
|
all: build golden
|
||
|
|
||
|
build:
|
||
|
@cd fizzbuzz && go build
|
||
|
|
||
|
golden: build best fizzbuzz.txt fizzbuzz.txt.real
|
||
|
@diff -u fizzbuzz.txt fizzbuzz.txt.real
|
||
|
@export CUR=$$(echo "$$(wc -c fizzbuzz/main.go | awk '{ print $$1 }') - 43" | bc) ; \
|
||
|
export BEST=$$(cat best) ; \
|
||
|
echo $$CUR > best ; \
|
||
|
echo $$CUR '<=' $$BEST ; \
|
||
|
test $$CUR -le $$BEST ; \
|
||
|
echo "scale=2; (200.0 - $$CUR) / 10.0" | bc
|
||
|
|
||
|
fizzbuzz.txt.real:
|
||
|
./fizzbuzz/fizzbuzz > $@
|
||
|
|
||
|
best:
|
||
|
echo 400 > $@
|
||
|
|
||
|
fizzbuzz.txt:
|
||
|
curl -O http://cdn.hackerrank.com/fizzbuzz.txt
|
||
|
|
||
|
.PHONY: all build golden
|