From faf4d96ef3e4b8e48199a0329887b819f75945f6 Mon Sep 17 00:00:00 2001 From: suhrke Date: Sat, 15 Jul 2017 01:26:03 -0700 Subject: [PATCH] Included catch-parser.cpp in catch.cpp --- ReflexToQ3/Makefile | 2 +- ReflexToQ3/test/catch-parser.cpp | 35 ++++++++++++++++---------------- ReflexToQ3/test/catch.cpp | 3 ++- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ReflexToQ3/Makefile b/ReflexToQ3/Makefile index c5340bf..6b6532f 100644 --- a/ReflexToQ3/Makefile +++ b/ReflexToQ3/Makefile @@ -35,5 +35,5 @@ EntityConverter.o: includes/EntityConverter.cpp $(CC) -c $^ $(CFLAGS) clean: - rm *.o *.log $(EX) $(TESTEX) + rm *.o *.log $(EX) diff --git a/ReflexToQ3/test/catch-parser.cpp b/ReflexToQ3/test/catch-parser.cpp index 431650c..cba2e15 100644 --- a/ReflexToQ3/test/catch-parser.cpp +++ b/ReflexToQ3/test/catch-parser.cpp @@ -4,27 +4,26 @@ #include #include #include -using namespace std; -vector readin(const string &filename, const int ln = 0) { - ifstream fin; - fin.open(filename); +std::vector readin(const std::string &filename, const int ln = 0) { + std::ifstream fin; + fin.open(filename); if (!fin.good()) { - cerr << "error: can not open file with test cases." << endl; + std::cerr << "error: can not open file with test cases." << std::endl; } - vector output; - string data; + std::vector output; + std::string data; while (getline(fin, data)) { output.push_back(data); } return output; } -bool test_parseface(const string &filename, const int &cnt_indices) { - vector test = readin(filename); - stringstream ss; - copy(test.begin(), test.end(), ostream_iterator(ss, "\n")); - vector x = parse_face(ss); +bool test_parseface(const std::string &filename, const int &cnt_indices) { + std::vector test = readin(filename); + std::stringstream ss; + copy(test.begin(), test.end(), std::ostream_iterator(ss, "\n")); + std::vector x = parse_face(ss); bool is_ok = true; for (struct TFace face : x) { if (face.m_Indices.size() != cnt_indices) { @@ -35,18 +34,18 @@ bool test_parseface(const string &filename, const int &cnt_indices) { return is_ok; } -TEST_CASE ( "face parsing case: faces with 3 indices " ) { - bool k = test_parseface("cases-faces/parser-face-3indices.txt", 3); +TEST_CASE ("face parsing case: faces with 3 indices", "[Parser]" ) { + bool k = test_parseface("ReflexToQ3/test/cases-face/parser-face-3indices.txt", 3); REQUIRE (k == true); } -TEST_CASE ("face parsing case: faces with 4 indices ") { - bool k = test_parseface("cases-faces/parser-face-4indices.txt", 4); +TEST_CASE ("face parsing case: faces with 4 indices", "[Parser]") { + bool k = test_parseface("ReflexToQ3/test/cases-face/parser-face-4indices.txt", 4); REQUIRE (k == true); } -TEST_CASE ("face parsing case: faces with 5 indices ") { - bool k = test_parseface("cases-faces/parser-face-5indices.txt", 5); +TEST_CASE ("face parsing case: faces with 5 indices", "[Parser]") { + bool k = test_parseface("ReflexToQ3/test/cases-face/parser-face-5indices.txt", 5); REQUIRE (k == true); } diff --git a/ReflexToQ3/test/catch.cpp b/ReflexToQ3/test/catch.cpp index d63ae36..36a2a22 100644 --- a/ReflexToQ3/test/catch.cpp +++ b/ReflexToQ3/test/catch.cpp @@ -3,7 +3,7 @@ * * Filename: catch.cpp * - * Description: Unit Tests for EntityConverter + * Description: Unit Tests using the Catch framework * * Version: 1.0 * Created: 07/03/2017 08:25:04 PM @@ -18,6 +18,7 @@ #ifndef CATCH_CONFIG_MAIN #define CATCH_CONFIG_MAIN #include "catch.hpp" +#include "catch-parser.cpp" #include #include #include