Skip to content

Commit

Permalink
[IMP] Tests: Remove unwanted comments and manage strings messages wit…
Browse files Browse the repository at this point in the history
…hout wxString
  • Loading branch information
rousseldenis committed Aug 13, 2024
1 parent 72fb1a3 commit 3e93100
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/tests/GOTestExe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main() {
++current, ++run_number_) {
auto test_result = *current;
wxLogMessage("-------------------------------------------------------");
wxLogMessage(test_result->GetMessage());
wxLogMessage(wxString(test_result->GetMessage()));
}

const int failed_count = GOTestCollection::Instance()->get_failed_count();
Expand Down
5 changes: 0 additions & 5 deletions src/tests/common/GOTestCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@

GOTestCollection::GOTestCollection() {}

// GOTestCollection::~GOTestCollection() {
// // Destroy the initialized tests in vector
// tests_.clear();
// }

void GOTestCollection::add_test(GOTest *test) {
/*
This method allows to add tests classes (derived from GOTest).
Expand Down
1 change: 0 additions & 1 deletion src/tests/common/GOTestCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "GOTest.h"
#include "GOTestResultCollection.h"
#include <vector>
#include <wx/string.h>

class GOTestCollection {
/*
Expand Down
10 changes: 5 additions & 5 deletions src/tests/common/GOTestException.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
#include <cpptrace.hpp>
#include <exception>
#include <iostream>
#include <wx/string.h>
#include <string>

class GOTestException : public std::exception {
private:
wxString message;
std::string message;

public:
GOTestException(wxString msg) : message(msg) {}
wxString what() {
wxString returned_message = message;
GOTestException(std::string msg) : message(msg) {}
std::string what() {
std::string returned_message = message;
returned_message = returned_message + "\n";

return returned_message;
Expand Down
10 changes: 7 additions & 3 deletions src/tests/common/GOTestResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
#include "GOTestResult.h"
#include <iostream>
#include <iterator>
#include <string>
#include <vector>

GOTestResult::GOTestResult() { this->failed = false; }
GOTestResult::GOTestResult() {
m_result_message = "";
this->failed = false;
}

GOTestResult::GOTestResult(wxString message) : m_result_message(message) {
GOTestResult::GOTestResult(std::string message) : m_result_message(message) {
failed = false;
}

GOTestResult::GOTestResult(wxString message, bool failed)
GOTestResult::GOTestResult(std::string message, bool failed)
: m_result_message(message) {
failed = failed;
}
13 changes: 4 additions & 9 deletions src/tests/common/GOTestResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,19 @@

#include "GOTest.h"
#include <vector>
#include <wx/string.h>

class GOTestResult {

private:
wxString m_result_message;
std::string m_result_message;
bool failed;

public:
GOTestResult();
GOTestResult(wxString message);
GOTestResult(wxString message, bool failed);
GOTestResult(std::string message);
GOTestResult(std::string message, bool failed);

const wxString GetMessage() {
wxString result = "";
result += m_result_message;
return result;
}
const std::string GetMessage() { return m_result_message; }
bool isFailed() { return failed; }
};

Expand Down
2 changes: 1 addition & 1 deletion src/tests/common/GOTestUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GOTestUtils {
*/

public:
void GOAssert(bool expression, wxString message) {
void GOAssert(bool expression, std::string message) {
/**
* This util function should be called as soon as we want to test an
* expression in the test framework and launch the appropriate Exception
Expand Down
2 changes: 1 addition & 1 deletion src/tests/testing/model/GOTestOrganModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
GOTestOrganModel::~GOTestOrganModel() {}

void GOTestOrganModel::run() {
wxString message;
std::string message;
// Set OrganModel Modified
this->controller->SetOrganModelModified(true);
message = "Is Organ Modified value is not True";
Expand Down
2 changes: 1 addition & 1 deletion src/tests/testing/model/GOTestSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
GOTestSwitch::~GOTestSwitch() {}

void GOTestSwitch::run() {
wxString message;
std::string message;

// Check global Switch
GOSwitch *go_switch = new GOSwitch(*this->controller);
Expand Down
2 changes: 1 addition & 1 deletion src/tests/testing/model/GOTestWindchest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
GOTestWindchest::~GOTestWindchest() {}

void GOTestWindchest::run() {
wxString message;
std::string message;
// Check the size of Windchest is correct
unsigned w_size;
w_size = this->controller->AddWindchest(new GOWindchest(*this->controller));
Expand Down

0 comments on commit 3e93100

Please sign in to comment.