forked from PetroleumCyberneticsGroup/FieldOpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <gtest/gtest.h> | ||
#include "eclgridreader.h" | ||
|
||
using namespace ERTWrapper; | ||
|
||
namespace { | ||
|
||
class ECLGridReaderTest : public ::testing::Test { | ||
protected: | ||
ECLGridReaderTest() { | ||
// Set-up work for each test | ||
} | ||
|
||
virtual ~ECLGridReaderTest() { | ||
// Clean-up work that does not throw exceptions. | ||
} | ||
|
||
virtual void SetUp() { | ||
// Called immediately after the constructor (right before each test) | ||
} | ||
|
||
virtual void TearDown() { | ||
// Called immedeately after each test (right before the destructor) | ||
} | ||
|
||
// Objects declared here can be used by all tests in this test case. | ||
}; | ||
|
||
TEST_F(ECLGridReaderTest, TestSomething) { | ||
EXPECT_EQ(0,0); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
include(../defaults.pri) | ||
QT += core | ||
TEMPLATE = app | ||
CONFIG += console | ||
CONFIG -= app_bundle | ||
CONFIG += c++11 | ||
LIBS += -L../src -lfieldopt | ||
LIBS += -L../ERTWrapper -lertwrapper | ||
LIBS += -lpthread -lgtest -pthread | ||
SOURCES += \ | ||
gtest_main.cpp \ | ||
ERTWrapper/test_eclgridreader.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Unit Tests | ||
|
||
Test are as of sept. 2015 created using the Google Test framework. | ||
|
||
Directions for setting up the library on Ubuntu and creating simple tests | ||
may be found at http://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/ | ||
|
||
## GTest Boilerplate | ||
|
||
This boilerplate code is taken from https://code.google.com/p/googletest/wiki/Primer | ||
At this site you can also find some additional documentation on writing tests using the googletest framework. | ||
|
||
``` | ||
#include "this/package/foo.h" | ||
#include "gtest/gtest.h" | ||
namespace { | ||
// The fixture for testing class Foo. | ||
class FooTest : public ::testing::Test { | ||
protected: | ||
// You can remove any or all of the following functions if its body | ||
// is empty. | ||
FooTest() { | ||
// You can do set-up work for each test here. | ||
} | ||
virtual ~FooTest() { | ||
// You can do clean-up work that doesn't throw exceptions here. | ||
} | ||
// If the constructor and destructor are not enough for setting up | ||
// and cleaning up each test, you can define the following methods: | ||
virtual void SetUp() { | ||
// Code here will be called immediately after the constructor (right | ||
// before each test). | ||
} | ||
virtual void TearDown() { | ||
// Code here will be called immediately after each test (right | ||
// before the destructor). | ||
} | ||
// Objects declared here can be used by all tests in the test case for Foo. | ||
}; | ||
// Tests that the Foo::Bar() method does Abc. | ||
TEST_F(FooTest, MethodBarDoesAbc) { | ||
const string input_filepath = "this/package/testdata/myinputfile.dat"; | ||
const string output_filepath = "this/package/testdata/myoutputfile.dat"; | ||
Foo f; | ||
EXPECT_EQ(0, f.Bar(input_filepath, output_filepath)); | ||
} | ||
// Tests that Foo does Xyz. | ||
TEST_F(FooTest, DoesXyz) { | ||
// Exercises the Xyz feature of Foo. | ||
} | ||
} // namespace | ||
int main(int argc, char **argv) { | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <iostream> | ||
#include <gtest/gtest.h> | ||
#include "ERTWrapper/test_eclgridreader.cpp" | ||
|
||
using namespace std; | ||
|
||
GTEST_API_ int main(int argc, char **argv) { | ||
printf("Running main() from gtest_main.cc\n"); | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
cd build-FieldOpt-Desktop-Debug/GTest | ||
./GTest | ||
cd ../../ |