Skip to content

Commit 0724508

Browse files
committed
Add coverage testing targets
1 parent 5485906 commit 0724508

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
*.la
1313
*.a
1414

15+
# Coverage testing files
16+
*.gcno
17+
*.gcda
18+
1519
# Compiled binaries
1620
examples
1721
test

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CXXFLAGS=-std=c++0x -Wall -Wextra -Weffc++ -g
1+
CXXFLAGS=-std=c++0x -Wall -Wextra -Weffc++ -g --coverage
22
CXX=g++
33
STATICFLAGS=$(CXXFLAGS) -c -fPIC
44
SHAREDFLAGS=$(CXXFLAGS) -shared
@@ -20,21 +20,21 @@ examples.o: examples.cpp MySql.hpp MySqlException.hpp InputBinder.hpp \
2020

2121
MySql.o: MySql.cpp MySql.hpp InputBinder.hpp OutputBinder.hpp \
2222
MySqlException.o MySqlException.hpp
23-
$(CXX) $(STATICFLAGS) MySql.cpp -o MySql.o
23+
$(CXX) $(CXXFLAGS) $(STATICFLAGS) MySql.cpp -o MySql.o
2424

2525
MySqlException.o: MySqlException.cpp MySqlException.hpp
26-
$(CXX) $(STATICFLAGS) MySqlException.cpp -o MySqlException.o
26+
$(CXX) $(CXXFLAGS) $(STATICFLAGS) MySqlException.cpp -o MySqlException.o
2727

2828
libmysqlcpp.so: MySql.o MySql.hpp MySqlException.o MySqlException.hpp \
2929
InputBinder.hpp OutputBinder.hpp
30-
$(CXX) $(SHAREDFLAGS) -W1,-soname,libmysqlcpp.so -o libmysqlcpp.so \
31-
MySql.o MySqlException.o
30+
$(CXX) $(CXXFLAGS) $(SHAREDFLAGS) -W1,-soname,libmysqlcpp.so \
31+
MySql.o MySqlException.o -o libmysqlcpp.so
3232

3333

3434
.PHONY: clean
3535
clean:
36-
rm -f *.o
36+
rm -f *.o *.gcno *.gcov *.gcna *.gcda
3737
rm -f libmysqlcpp.so
3838
rm -f examples
39-
rm -f tests/*.o
39+
rm -f tests/*.o tests/*.gcno tests/*.gcov tests/*.gcna tests/*.gcda
4040
rm -f test

tests/testMySql.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ void testInvalidCommands()
347347
connection->runCommand("Dance for me, MySQL!"),
348348
MySqlException
349349
);
350+
BOOST_CHECK_THROW(
351+
connection->runCommand("Dance for me, MySQL!", brandon),
352+
MySqlException
353+
);
350354
BOOST_CHECK_THROW(
351355
connection->runQuery(
352356
&counts,

0 commit comments

Comments
 (0)