Included catch-parser.cpp in catch.cpp
This commit is contained in:
parent
77ae309e3b
commit
faf4d96ef3
@ -35,5 +35,5 @@ EntityConverter.o: includes/EntityConverter.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
clean:
|
||||
rm *.o *.log $(EX) $(TESTEX)
|
||||
rm *.o *.log $(EX)
|
||||
|
||||
|
@ -4,27 +4,26 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
vector<string> readin(const string &filename, const int ln = 0) {
|
||||
ifstream fin;
|
||||
fin.open(filename);
|
||||
std::vector<std::string> 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<string> output;
|
||||
string data;
|
||||
std::vector<std::string> 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<string> test = readin(filename);
|
||||
stringstream ss;
|
||||
copy(test.begin(), test.end(), ostream_iterator<string>(ss, "\n"));
|
||||
vector<TFace> x = parse_face<stringstream>(ss);
|
||||
bool test_parseface(const std::string &filename, const int &cnt_indices) {
|
||||
std::vector<std::string> test = readin(filename);
|
||||
std::stringstream ss;
|
||||
copy(test.begin(), test.end(), std::ostream_iterator<std::string>(ss, "\n"));
|
||||
std::vector<TFace> x = parse_face<std::stringstream>(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);
|
||||
}
|
||||
|
||||
|
@ -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 <cmath>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
|
Loading…
Reference in New Issue
Block a user