From 36f3aa0a1b9f0b7da83991b9a55b21bf9e042ab3 Mon Sep 17 00:00:00 2001 From: <> Date: Mon, 17 Jul 2017 06:46:50 -0700 Subject: [PATCH] Removed old parser testing program --- ReflexToQ3/test/cases-parser.sh | 22 ------- ReflexToQ3/test/test-parser.cpp | 102 -------------------------------- 2 files changed, 124 deletions(-) delete mode 100644 ReflexToQ3/test/cases-parser.sh delete mode 100644 ReflexToQ3/test/test-parser.cpp diff --git a/ReflexToQ3/test/cases-parser.sh b/ReflexToQ3/test/cases-parser.sh deleted file mode 100644 index 1fd0a77..0000000 --- a/ReflexToQ3/test/cases-parser.sh +++ /dev/null @@ -1,22 +0,0 @@ - -# Test if the parser is correctly reading in faces with 3 indices. -# Map Versions as of : 4:26 PM 4/8/2017 - -function test () { - if [ "$1" == "$2" ]; then - echo "test passed" - else - echo "test failed" - echo $2 - fi -} - -# test parser will read in the data and output it in the same format. -dir="cases" -for each in "$dir"/* - do - echo "$each" - ansr=$(cat $each) - test=$(./test-parser --face $each 0) - test $ansr $test -done diff --git a/ReflexToQ3/test/test-parser.cpp b/ReflexToQ3/test/test-parser.cpp deleted file mode 100644 index 98e8063..0000000 --- a/ReflexToQ3/test/test-parser.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "oopless-parser.hpp" -#include "brushdef.hpp" -#include -#include -using namespace std; - -// human read output -void print_TFace(const TFace x, int i) { - cout << "----------------------------" << endl; - cout << "TFace #" << i << endl; - cout << "\tOffset X: " << x.m_fXOffset << endl; - cout << "\tOffset Y: " << x.m_fYOffset << endl; - cout << "\tScale X: " << x.m_fXScale << endl; - cout << "\tScale Y: " << x.m_fYScale << endl; - cout << "\tRotation: " << x.m_fRotation << endl; - for (unsigned int i = 0; i < x.m_Indices.size(); ++i) { - cout << x.m_Indices[i] << ", "; - } - cout << "\n\tMaterial: " << x.m_Material << endl; - cout << "----------------------------" << endl; -} - -// for bash script to compare strings. -void print_TFace(const TFace x) { -#define FMT_PRECISION 6 - cout <<"\t\t\t" - << fixed << setprecision(FMT_PRECISION) << x.m_fXOffset << " " - << fixed << setprecision(FMT_PRECISION) << x.m_fYOffset << " " - << fixed << setprecision(FMT_PRECISION) << x.m_fXScale << " " - << fixed << setprecision(FMT_PRECISION) << x.m_fYScale << " " - << fixed << setprecision(FMT_PRECISION) << x.m_fRotation << " "; - for (const int index : x.m_Indices) { - cout << index << " "; - } - cout << "0x" << hex << x.hex << " " - << x.m_Material; - cout << endl; -} - -// jump to a line in fstream -// this is to set the stream position to test individual parsing functions. -void gotoline(ifstream &f, unsigned int n) { - string t; - for (unsigned int i = 0; i < n; ++i) { - getline(f, t); - } -} - -void test_parsevertices (const char * const fn, const int ln) { - ifstream fin; - fin.open(fn); - string line; - gotoline(fin, ln); - vector x = parse_vertices(fin); - cout << "size has a size of " << x.size() << endl; - // display data retrieved. - for (unsigned int i = 0; i < x.size(); ++i) { - for (unsigned int j = 0; j < 3; ++j) { - cout << x[i][j] << "\t"; - } - cout << endl; - } - getline(fin, line); - cout << "check stream state \n current line: " << endl; - cout << line << endl; - fin.close(); -} - -// test if faces are parsing correctly -void test_parseface(const char * const fn, const int ln) { - ifstream fin; - fin.open(fn); - string line; - gotoline(fin, ln); - vector x = parse_face(fin); -// cout << "size has a size of " << x.size() << endl; -// display data retrieved. - for (unsigned int i = 0; i < x.size(); ++i) { - print_TFace(x[i]); - } - // parse_face will rollback to a position if it comes across a keyword - // check the line that fin will retrieve. -// getline(fin, line); -// cout << "check stream state \n current line: " << endl; -// cout << line << endl; - fin.close(); -} - -int main(int argc, const char *argv[]) { -// test_parsevertices("empty.map", 10); -// test_parseface("empty.map", 19); - -// test_parsevertices("pocket-infinity.map", 134); - - if (string(argv[1]) == "--face" || string(argv[1]) == "-f") { - if (argc < 4) { - cerr << "expected: 3 arguments to program - given: " << argc << endl; - return -1; - } - test_parseface(argv[2], stoi(argv[3])); - } -}