Skip to content

Commit

Permalink
Lower down GCC required version to 4.7
Browse files Browse the repository at this point in the history
Resolve #28
  • Loading branch information
fushar committed Mar 29, 2015
1 parent 38b3adf commit c98c115
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 57 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ before_install:
- sudo pip install cpp-coveralls

install:
- sudo apt-get -qq install g++-4.9
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 90
- sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.9 90
- sudo apt-get -qq install g++-4.7
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 90
- sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.7 90
- sudo apt-get install libgtest-dev
- cd /usr/src/gtest && sudo cmake . && sudo cmake --build . && sudo mv libg* /usr/local/lib/ ; cd -

Expand Down
2 changes: 1 addition & 1 deletion docs/basic_concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ For example:

.. note::

The current version needs GCC version 4.9.
The current version needs GCC version >= 4.7.

Running generator program
-------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Dependencies
**tcframe** needs the following minimum requirements:

- UNIX-based operating system
- GCC >= 4.9
- GCC >= 4.7

Setup
-----
Expand Down
2 changes: 1 addition & 1 deletion include/tcframe/exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class NotImplementedException : public exception { };

class TestCaseException : public exception {
public:
virtual ~TestCaseException() { }
virtual ~TestCaseException() noexcept { }

vector<Failure> getFailures() {
if (message != "") {
Expand Down
12 changes: 6 additions & 6 deletions include/tcframe/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class LineIOSegment : public IOSegment {
throw IOFormatException("Variable type of `" + names[variables.size()] + "` unsatisfied. Expected: basic scalar or string type, or vector of those types");
}

void printTo(ostream& out) override {
void printTo(ostream& out) {
bool first = true;
for (int i = 0; i < variables.size(); i++) {
HorizontalVariable* variable = variables[i];
Expand All @@ -114,7 +114,7 @@ class LineIOSegment : public IOSegment {
out << "\n";
}

void parseFrom(istream& in) override {
void parseFrom(istream& in) {
for (int i = 0; i < variables.size(); i++) {
HorizontalVariable* variable = variables[i];

Expand Down Expand Up @@ -214,7 +214,7 @@ class LinesIOSegment : public IOSegment {
}
}

void printTo(ostream& out) override {
void printTo(ostream& out) {
checkState();
checkVectorSizes();

Expand All @@ -231,7 +231,7 @@ class LinesIOSegment : public IOSegment {
}
}

void parseFrom(istream& in) override {
void parseFrom(istream& in) {
checkState();

for (VerticalVariable* variable : variables) {
Expand Down Expand Up @@ -323,7 +323,7 @@ class GridIOSegment : public IOSegment {
}
}

void printTo(ostream& out) override {
void printTo(ostream& out) {
checkState();
checkMatrixSizes();

Expand All @@ -338,7 +338,7 @@ class GridIOSegment : public IOSegment {
}
}

void parseFrom(istream& in) override {
void parseFrom(istream& in) {
checkState();
variable->clear();

Expand Down
14 changes: 7 additions & 7 deletions include/tcframe/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class Logger {

class StandardLogger : public Logger {
public:
void logIntroduction() override {
void logIntroduction() {
cout << "Generating test cases..." << endl;
}

void logTestGroupIntroduction(int testGroupId) override {
void logTestGroupIntroduction(int testGroupId) {
cout << endl;

if (testGroupId == 0) {
Expand All @@ -44,15 +44,15 @@ class StandardLogger : public Logger {
}
}

void logTestCaseIntroduction(string testCaseName) override {
void logTestCaseIntroduction(string testCaseName) {
cout << " " << testCaseName << ": " << flush;
}

void logTestCaseOkResult() override {
void logTestCaseOkResult() {
cout << "OK" << endl;
}

void logTestCaseFailedResult(string testCaseDescription) override {
void logTestCaseFailedResult(string testCaseDescription) {
cout << "FAILED" << endl;

if (testCaseDescription != "") {
Expand All @@ -62,13 +62,13 @@ class StandardLogger : public Logger {
cout << " Reasons:" << endl;
}

void logInputFormatFailedResult() override {
void logInputFormatFailedResult() {
cout << endl;
cout << " Input format check: FAILED" << endl;
cout << " Reasons:" << endl;
}

void logFailures(vector<Failure> failures) override {
void logFailures(vector<Failure> failures) {
for (Failure failure : failures) {
string prefix;
if (failure.getLevel() == 0) {
Expand Down
10 changes: 5 additions & 5 deletions include/tcframe/os.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,28 @@ class UnixOperatingSystem : public OperatingSystem {
UnixOperatingSystem()
: baseDirectoryName(".") { }

void setBaseDirectory(string baseDirectoryName) override {
void setBaseDirectory(string baseDirectoryName) {
this->baseDirectoryName = baseDirectoryName;

system(("rm -rf " + baseDirectoryName).c_str());
system(("mkdir -p " + baseDirectoryName).c_str());
}

istream* openForReading(string name) override {
istream* openForReading(string name) {
string filename = baseDirectoryName + "/" + name;
ifstream* file = new ifstream();
file->open(filename);
return file;
}

ostream* openForWriting(string name) override {
ostream* openForWriting(string name) {
string filename = baseDirectoryName + "/" + name;
ofstream* file = new ofstream();
file->open(filename);
return file;
}

ExecutionResult execute(string command, string inputName, string outputName) override {
ExecutionResult execute(string command, string inputName, string outputName) {
string inputFilename = baseDirectoryName + "/" + inputName;
string outputFilename = baseDirectoryName + "/" + outputName;
string errorFilename = baseDirectoryName + "/_error.out";
Expand All @@ -73,7 +73,7 @@ class UnixOperatingSystem : public OperatingSystem {
return result;
}

void remove(string name) override {
void remove(string name) {
string filename = baseDirectoryName + "/" + name;
removeFile(filename);
}
Expand Down
8 changes: 4 additions & 4 deletions include/tcframe/testcase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class OfficialTestCase : public TestCase {
OfficialTestCase(function<void()> closure, string description, set<int> subtaskIds)
: closure(closure), description(description), subtaskIds(subtaskIds) { }

string getDescription() override {
string getDescription() {
return description;
}

set<int> getSubtaskIds() override {
set<int> getSubtaskIds() {
return subtaskIds;
}

Expand All @@ -52,11 +52,11 @@ class SampleTestCase : public TestCase {
SampleTestCase(string content, set<int> subtaskIds) :
content(content), subtaskIds(subtaskIds) { }

string getDescription() override {
string getDescription() {
return "";
}

set<int> getSubtaskIds() override {
set<int> getSubtaskIds() {
return subtaskIds;
}

Expand Down
34 changes: 17 additions & 17 deletions include/tcframe/type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ class Scalar : public ScalarHorizontalVariable {
Scalar(T& value, string name)
: ScalarHorizontalVariable(name), value(&value) { }

void printTo(ostream& out) override {
void printTo(ostream& out) {
out << *value;
}

void parseFrom(istream& in) override {
void parseFrom(istream& in) {
parseVariableFrom(in, value, getName());
}

void clear() override {
void clear() {
*value = T();
}

Expand All @@ -139,22 +139,22 @@ class HorizontalVector : public VectorHorizontalVariable {
HorizontalVector(vector<T>& value, string name)
: VectorHorizontalVariable(name), value(&value) { }

int size() override {
int size() {
return (int)(value->size());
}

void printElementTo(int index, ostream& out) override {
void printElementTo(int index, ostream& out) {
out << (*value)[index];
}

void parseAndAddElementFrom(istream& in) override {
void parseAndAddElementFrom(istream& in) {
int index = (int)value->size();
T element;
parseVariableFrom(in, &element, getName() + "[" + Util::toString(index) + "]");
value->push_back(element);
}

void clear() override {
void clear() {
*value = vector<T>();
}

Expand All @@ -181,22 +181,22 @@ class VerticalVector : public VerticalVariable {
VerticalVector(vector<T>& value, string name)
: VerticalVariable(name), value(&value) { }

int size() override {
int size() {
return (int)(value->size());
}

void printElementTo(int index, ostream& out) override {
void printElementTo(int index, ostream& out) {
out << (*value)[index];
}

void parseAndAddElementFrom(istream& in) override {
void parseAndAddElementFrom(istream& in) {
int index = (int)value->size();
T element;
parseVariableFrom(in, &element, getName() + "[" + Util::toString(index) + "]");
value->push_back(element);
}

void clear() override {
void clear() {
*value = vector<T>();
}

Expand Down Expand Up @@ -225,23 +225,23 @@ class Matrix : public MatrixVariable {
Matrix(vector<vector<T>>& value, string name)
: MatrixVariable(name), value(&value) { }

int rowsSize() override {
int rowsSize() {
return (int)(value->size());
}

int columnsSize(int rowIndex) override {
int columnsSize(int rowIndex) {
return (int)((*value)[rowIndex].size());
}

void printElementTo(int rowIndex, int columnIndex, ostream& out) override {
void printElementTo(int rowIndex, int columnIndex, ostream& out) {
out << (*value)[rowIndex][columnIndex];
}

void addRow() override {
void addRow() {
value->push_back(vector<T>());
}

void parseAndAddColumnElementFrom(istream& in) override {
void parseAndAddColumnElementFrom(istream& in) {
int rowIndex = (int)value->size() - 1;
int columnIndex = (int)value->back().size();

Expand All @@ -250,7 +250,7 @@ class Matrix : public MatrixVariable {
value->back().push_back(element);
}

void clear() override {
void clear() {
*value = vector<vector<T>>();
}

Expand Down
24 changes: 12 additions & 12 deletions test/generator_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ class FakeLogger : public Logger {
FakeLogger()
: currentKey("inputFormat") { }

void logIntroduction() override { }
void logTestGroupIntroduction(int) override { }
void logIntroduction() { }
void logTestGroupIntroduction(int) { }

void logTestCaseIntroduction(string testCaseName) override {
void logTestCaseIntroduction(string testCaseName) {
currentKey = testCaseName;
}

void logTestCaseOkResult() override { }
void logTestCaseFailedResult(string) override { }
void logInputFormatFailedResult() override { }
void logTestCaseOkResult() { }
void logTestCaseFailedResult(string) { }
void logInputFormatFailedResult() { }

void logFailures(vector<Failure> failures) override {
void logFailures(vector<Failure> failures) {
this->failuresMap[currentKey] = failures;
}

Expand All @@ -58,21 +58,21 @@ class FakeOperatingSystem : public OperatingSystem {
FakeOperatingSystem(set<string> arrangedFailedInputNames)
: arrangedFailedInputNames(arrangedFailedInputNames) { }

void setBaseDirectory(string) override { }
void setBaseDirectory(string) { }

istream* openForReading(string) override {
istream* openForReading(string) {
return new istringstream();
}

ostream* openForWriting(string name) override {
ostream* openForWriting(string name) {
ostringstream* testCaseInput = new ostringstream();
testCaseInputs[name] = testCaseInput;
return testCaseInput;
}

void remove(string) override { }
void remove(string) { }

ExecutionResult execute(string, string inputName, string) override {
ExecutionResult execute(string, string inputName, string) {
if (arrangedFailedInputNames.count(inputName)) {
return ExecutionResult{1, new istringstream(), new istringstream("Intentionally failed")};
}
Expand Down

0 comments on commit c98c115

Please sign in to comment.