Permalink
Browse files

Merge commit 'd864f7ef4f4a2efc89019420de54c960d5eeb5df' as 'ext/tinyf…

…ormat'
  • Loading branch information...
orbea
orbea committed Nov 16, 2017
2 parents d954baf + d864f7e commit 2fef04f55c0370873169b7addde13d3c1d511737
@@ -0,0 +1,3 @@
_bloat_test_tmp*
tinyformat_test_cxx*
tinyformat_speed_test
@@ -0,0 +1,56 @@
# Build and run the unit tests (or speed tests) on linux
#
# Should work with recent versions of both gcc and clang. (To compile with
# clang use "make CXX=clang++".)

CXXFLAGS?=-Wall
CXX11FLAGS?=-std=c++0x

test: tinyformat_test_cxx98 tinyformat_test_cxx11
@echo running tests...
@./tinyformat_test_cxx98 && \
./tinyformat_test_cxx11 && \
! $(CXX) $(CXXFLAGS) -std=c++98 -DTINYFORMAT_NO_VARIADIC_TEMPLATES \
-DTEST_WCHAR_T_COMPILE tinyformat_test.cpp 2> /dev/null && \
echo "No errors" || echo "Tests failed"

doc: tinyformat.html

speed_test: tinyformat_speed_test
@echo running speed tests...
@echo printf timings:
@time -p ./tinyformat_speed_test printf > /dev/null
@echo iostreams timings:
@time -p ./tinyformat_speed_test iostreams > /dev/null
@echo tinyformat timings:
@time -p ./tinyformat_speed_test tinyformat > /dev/null
@echo boost timings:
@time -p ./tinyformat_speed_test boost > /dev/null

tinyformat_test_cxx98: tinyformat.h tinyformat_test.cpp Makefile
$(CXX) $(CXXFLAGS) -std=c++98 -DTINYFORMAT_NO_VARIADIC_TEMPLATES tinyformat_test.cpp -o tinyformat_test_cxx98

tinyformat_test_cxx11: tinyformat.h tinyformat_test.cpp Makefile
$(CXX) $(CXXFLAGS) $(CXX11FLAGS) -DTINYFORMAT_USE_VARIADIC_TEMPLATES tinyformat_test.cpp -o tinyformat_test_cxx11

tinyformat.html: README.rst
@echo building docs...
rst2html.py README.rst > tinyformat.html

tinyformat_speed_test: tinyformat.h tinyformat_speed_test.cpp Makefile
$(CXX) $(CXXFLAGS) -O3 -DNDEBUG tinyformat_speed_test.cpp -o tinyformat_speed_test

bloat_test:
@for opt in '' '-O3 -DNDEBUG' ; do \
for use in '' '-DUSE_IOSTREAMS' '-DUSE_TINYFORMAT' '-DUSE_TINYFORMAT $(CXX11FLAGS)' '-DUSE_BOOST' ; do \
echo ; \
echo ./bloat_test.sh $(CXX) $$opt $$use ; \
./bloat_test.sh $(CXX) $$opt $$use ; \
done ; \
done


clean:
rm -f tinyformat_test_cxx98 tinyformat_test_cxx11 tinyformat_speed_test
rm -f tinyformat.html
rm -f _bloat_test_tmp_*
@@ -0,0 +1,12 @@
# Build and run the unit tests on windows with MSVC.
#
# To use, open a visual studio command prompt and type
#
# nmake -f Makefile.nmake

test: tinyformat_test_cxx98
@echo running tests...
@tinyformat_test_cxx98 && echo "No errors"

tinyformat_test_cxx98: tinyformat.h tinyformat_test.cpp
cl -W3 -EHsc -DTINYFORMAT_NO_VARIADIC_TEMPLATES tinyformat_test.cpp -Fetinyformat_test_cxx98
Oops, something went wrong.

0 comments on commit 2fef04f

Please sign in to comment.