Commit cae6b30f authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Improved belcard-tester

parent 985a53ef
......@@ -18,6 +18,10 @@ belcard_tester_SOURCES=belcard-tester.cpp belcard-tester.hpp common/bc_tester_ut
belcard-vcard-tester.cpp
belcard_tester_LDADD=$(top_builddir)/src/libbelcard.la -lbelr $(CUNIT_LIBS)
belcard_tester_CFLAGS=\
-DBC_CONFIG_FILE=\"config.h\" \
$(CUNIT_CFLAGS)
belcard_tester_AM_CPPFLAGS=-I$(top_srcdir)/include \
-I$(top_srcdir)/tester \
-I$(top_srcdir)/tester/common
......
......@@ -32,13 +32,13 @@ void belcard_tester_uninit(void);
template<typename T>
void test_property(const std::string& input) {
std::shared_ptr<T> var = T::parse(input);
BC_ASSERT_TRUE_FATAL(var != NULL);
std::stringstream sstream;
sstream << *var;
BC_ASSERT_EQUAL(input.compare(sstream.str()), 0, int, "%d");
if (input.compare(sstream.str()) != 0) {
std::cout << "Expected " << input << " but got " << sstream.str() << std::endl;
std::shared_ptr<T> ptr = T::parse(input);
BC_ASSERT_TRUE_FATAL(ptr != NULL);
std::string str = ptr->toString();
int compare = input.compare(str);
BC_ASSERT_EQUAL(compare, 0, int, "%d");
if (compare != 0) {
std::cout << "Expected " << input << " but got " << str << std::endl;
}
}
......
......@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* this must be provided at compile time*/
//#include BC_CONFIG_FILE
#include BC_CONFIG_FILE
#include "bc_tester_utils.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment