CoxIter  1.3
CoxIter - Computing invariants of hyperbolic Coxeter groups
tests.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2013, 2014, 2015, 2016, 2017
3 Rafael Guglielmetti, rafael.guglielmetti@unifr.ch
4 */
5 
6 /*
7 This file is part of CoxIter.
8 
9 CoxIter is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as
11 published by the Free Software Foundation, either version 3 of the
12 License, or (at your option) any later version.
13 
14 CoxIter is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with CoxIter. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef __TESTS_H__
24 #define __TESTS_H__
25 
26 #include "../arithmeticity.h"
27 #include "../coxiter.h"
28 #include "../growthrate.h"
29 #include "../lib/numbers/mpz_rational.h"
30 #include "../lib/regexp.h"
31 #include "../signature.h"
32 
33 #include <chrono>
34 #include <fstream>
35 #include <iomanip>
36 #include <iostream>
37 #include <map>
38 #include <omp.h>
39 #include <string>
40 #include <vector>
41 
42 using namespace std;
43 
52 struct Test {
53  string filename;
54 
55  bool testEuler;
57 
58  bool testFVector;
59  vector<unsigned int> fVector;
60 
62  bool isCompact;
65  bool isArithmetic;
66 
68  vector<mpz_class>
71  vector<unsigned int>
74  string growthRate;
75 };
76 
80 class Tests {
81 private:
82  string error;
83  string inputFilename;
84  vector<Test> tests;
85 
86  ofstream of;
87 
88  map<string, array<unsigned int, 2>>
90  map<string, string> testDescription;
91  unsigned int testsUnknownErrors;
92 
93 public:
94  Tests();
95 
103  bool readGraphsFile(string inputFilename);
104 
109  bool runTests();
110 
111  string get_error() const;
112  vector<Test> get_tests() const;
113  unsigned int get_testsCount() const;
114 
115 private:
116  bool runTests_computations(const unsigned int &testIndex, CoxIter *ci);
117  void runTests_arithmeticity(const unsigned int &testIndex, CoxIter *ci);
118  void runTests_cocompactness_cofiniteness(const unsigned int &testIndex,
119  CoxIter *ci);
120  void runTests_growth(const unsigned int &testIndex, CoxIter *ci);
121  void runTests_signature(const unsigned int &testIndex, CoxIter *ci,
122  const unsigned int &dim);
123  void runTests_euler(const unsigned int &testIndex, CoxIter *ci);
124  void runTests_fVector(const unsigned int &testIndex, CoxIter *ci);
125 
126  void runTestsError(const unsigned int &testIndex, const string &test,
127  const string &expected, const string &computed);
128 
131 
132  string strIntToString(const int &i);
133 };
134 
135 #endif
Main class for the work.
Definition: coxiter.h:74
Definition: mpz_rational.h:49
Class to perform the tests.
Definition: tests.h:80
void runTests_cocompactness_cofiniteness(const unsigned int &testIndex, CoxIter *ci)
map< string, string > testDescription
For each test, description.
Definition: tests.h:90
void runTests_signature(const unsigned int &testIndex, CoxIter *ci, const unsigned int &dim)
unsigned int testsUnknownErrors
Number of other errors.
Definition: tests.h:91
ofstream of
Output to file.
Definition: tests.h:86
string inputFilename
File which contains the tests.
Definition: tests.h:83
void runTests_fVector(const unsigned int &testIndex, CoxIter *ci)
void runTestsError(const unsigned int &testIndex, const string &test, const string &expected, const string &computed)
void runTests_euler(const unsigned int &testIndex, CoxIter *ci)
void runTests_init()
unsigned int get_testsCount() const
vector< Test > get_tests() const
bool runTests()
Perform the tests.
void runTests_growth(const unsigned int &testIndex, CoxIter *ci)
bool runTests_computations(const unsigned int &testIndex, CoxIter *ci)
string error
Eventually, error code.
Definition: tests.h:82
void runTests_arithmeticity(const unsigned int &testIndex, CoxIter *ci)
string get_error() const
vector< Test > tests
Tests toi be performed.
Definition: tests.h:84
void runTests_displayInfo()
map< string, array< unsigned int, 2 > > testsSucceded
For each test, number of success, failure.
Definition: tests.h:89
string strIntToString(const int &i)
[*, 0, 1] => "?", "no", "yes"
Contains information to perform a test.
Definition: tests.h:52
bool testCompacity
True if we test the cocompacity.
Definition: tests.h:61
bool testArithmeticity
True if we test the arithmeticity.
Definition: tests.h:64
vector< unsigned int > fVector
Theoretical value.
Definition: tests.h:59
bool isFiniteVolume
True if finite covolume.
Definition: tests.h:63
bool testGrowthSeries
Definition: tests.h:67
MPZ_rational brResult
Theoretical Euler characteristic.
Definition: tests.h:56
string filename
Path to the .coxiter file.
Definition: tests.h:53
bool isArithmetic
True if arithmetic.
Definition: tests.h:65
bool testFVector
If we have to check the f-vector.
Definition: tests.h:58
vector< unsigned int > growthSeries_cyclotomicNumerator
Definition: tests.h:72
string growthRate
Empty or the growth rate.
Definition: tests.h:74
bool isCompact
True if the group is cocompact, false otherwise.
Definition: tests.h:62
vector< mpz_class > growthSeries_polynomialDenominator
Definition: tests.h:69
bool testEuler
If we have to check the Euler characteristic.
Definition: tests.h:55