Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileName gtest conversion #568

Merged
merged 4 commits into from
Nov 19, 2018
Merged

FileName gtest conversion #568

merged 4 commits into from
Nov 19, 2018

Conversation

makaylas
Copy link
Contributor

No description provided.

Copy link
Contributor

@jessemapel jessemapel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just have a few comments, I think this is ready to go though.

#include <iostream>
#include <fstream>
#include <stdlib.h>

#include <gtest/gtest.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the gtest include once you have gmock included

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I don't use gmock so I shouldn't be including it. I'll remove gmock

FileName file("$ISISTMPROOT/test.cub");

EXPECT_EQ("/testy/mc/test/face/test.cub", file.expanded());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just use the ISISROOT environment variable here? You can just check that the expanded filename contains the ISISROOT variable and test.cub

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because someone's ISISROOT may be set to s different directory and I don't want to override the current ISISROOT

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean you can just use the already set ISISROOT environment variable. That way you don't need to set another global environment variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except that ISISROOT is going to expanded differently whenever someone has it set to something else

remove("test000001.cub");
remove("test000002.cub");

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you run into an exception during this test, the files won't get cleaned up. You can use a fixture's setup and teardown methods to setup the files and ensure that they get removed even if the test doesn't run to completion.

// TEST(FileName, Version) {
//TODO Do we need to test this? All it does is call expanded, makes a QFileInfo and then make a QDir
// We shouldn't be testing Qt
// TEST(FileName, Dir) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree don't test it

@jlaura jlaura merged commit e45a500 into DOI-USGS:testing Nov 19, 2018
SgStapleton pushed a commit that referenced this pull request Nov 21, 2018
* Updated the cmake version to 3.10

* Adding configurations for gtest

* Tweaking things for gtest

* Got gtest working and made a small example test

* Updated the cmake version to be 3.10 or greater

* Added initial Angle test refactor to use gtest

* Add IException and QDebug tests

* Added the rest of the IException tests

* Added test file discovery support and seperated the main into another file

* Added more tests for FileName

* Updated with the new testing guidelines and added new tests.

* Added Spectel unittest for gtest environment

* Added gmock

* Forgot to save a file

* PixelTest (#536)

* initial Pixel test

* Add more test cases for Pixel

* testing parameterization in Pixel test

* testing function parameterization

* parameterize static vs object methods

* basic PixelTests implementation

* clean up and more static tests

* update PixelTests with float/dbl expects

* Added Endian unit test.

* Angle test refactor to use gtest (#529)

* Added initial Angle test refactor to use gtest

* Add IException and QDebug tests

* Added the rest of the IException tests

* Update Angle to make private methods public and add tests

* Made changes for review comments

* Cleanup and addition of streaming the actual errors thrown to the EXPECT_TRUE macro

* FileName gtest conversion (#568)

* Made two methods private as they are only used within FileName

* Added more tests

* Added more tests

* Update FileNameTests.cpp

* BundleSettings unit test (#538)

* added build to git ignore

* Fixed duplicate main in FileNameTests

* Added parameterized test example

* Added more tests

* Mored BundleSettings tests

* Even more tests

* Added mocked targetbody settings for BundleSettings test

* Added BundleSettings save tests

* Fixed BundleSetting save tests to just use a QString

* Added default and copy constructor tests and asignment

* Update FileName test and merge dev into testing (#598)

* Update CMakeLists.txt with version 3.6.0 (patch 1)

* Update cmake/CMakeLists.txt library version

* Updated the Installation instructions based on user feedback.  Also fixed a problem with the isis3VarInit.py script.

* Updates made in accordance with requests made on this PR by other developers.

* Fix tgo cassis unit test correctly

* Fix tgo cassis unit test correctly (#544)

* Fixed two bug with AutoReg. One occurs with one dimensional pattern cubes and the other causes the revious registration sample/line to be returned on sub-pixel registration failure.

* Fix tgo cassis camera truth again (#554)

* Update docsys Makefile to support wwwdoc (#559)

The documentation is installed under `docs`, not `doc`, so this file has been updated.
`setisis isis3.6.0` and running `make wwwdoc` in `$ISISROOT/../isis/src/docsys` will properly sync the documentation to our web server.

* Update isis3VarInit.py

Unnecessary 'touch'ing, the '>' redirect will create the file if it doesn't exist.
Also, the first redirect should be the single '>'.  Otherwise, multiple runs of this program will continue appending to these files.  They still work, its just a lot of setting and unsetting for no good reason.

* Fixed isis3Startup scripts

* Removed unneeded LineEquation include

* Make this program more pythonic (#589)

* Updated documentation, user interaction, and made the file and directory
handling more 'pythonic'.

* Correcting for PR comments.

* Fixed broken links in the Installation instructions due to the hyperlinks to our GitHub wiki changing.

* Removed unused Parabola class

* Removed old license, added new unlicense (#594)

* Tweaked FileName test to use ISISROOT variable

* App to callable function conversion rough draft (#530)

* adjusted Process to support lambdas with captures, updated crop app

* now compiling with colocated funcs and apps and duplicated symbols accross apps removed

* removed debug prints in cmake scripts

* changes as requested from review

* hapke comment

* Added Distance unit tests (#585)

* Added Distance unit tests.

* Changed EXPECT_FLOAT_EQ to EXPECT_DOUBLE_EQ and changed Solar Radii test to use one solar radii.

* Changed unneeded EXPECT_DOUBLE_EQ to EXPECT_EQ.

* Fixed toString test.

* Adding gtests for Color and Matrix (#532)

* Adding gtests for Color and Matrix

* Updating gtest for Matrix

* More work to ColorTests.cpp and MatrixTests.cpp

* Added test for constructor making use of TNT:Array2D in MatrixTests

* Update isis/tests/MatrixTests.cpp

Co-Authored-By: SgStapleton <[email protected]>

* Update isis/tests/MatrixTests.cpp

Co-Authored-By: SgStapleton <[email protected]>

* Making recommended changes

* Fixing odd GitHub behavior...

There were suggested changes made in PR that were not playing nicely. Could not push correct version for whatever reason.

* Add Utilities, clean up testing (#604)

* Update CMakeLists.txt with version 3.6.0 (patch 1)

* Update cmake/CMakeLists.txt library version

* Updated the Installation instructions based on user feedback.  Also fixed a problem with the isis3VarInit.py script.

* Updates made in accordance with requests made on this PR by other developers.

* Fix tgo cassis unit test correctly

* Fix tgo cassis unit test correctly (#544)

* Fixed two bug with AutoReg. One occurs with one dimensional pattern cubes and the other causes the revious registration sample/line to be returned on sub-pixel registration failure.

* Fix tgo cassis camera truth again (#554)

* Update docsys Makefile to support wwwdoc (#559)

The documentation is installed under `docs`, not `doc`, so this file has been updated.
`setisis isis3.6.0` and running `make wwwdoc` in `$ISISROOT/../isis/src/docsys` will properly sync the documentation to our web server.

* Update isis3VarInit.py

Unnecessary 'touch'ing, the '>' redirect will create the file if it doesn't exist.
Also, the first redirect should be the single '>'.  Otherwise, multiple runs of this program will continue appending to these files.  They still work, its just a lot of setting and unsetting for no good reason.

* Fixed isis3Startup scripts

* Removed unneeded LineEquation include

* Make this program more pythonic (#589)

* Updated documentation, user interaction, and made the file and directory
handling more 'pythonic'.

* Correcting for PR comments.

* Fixed broken links in the Installation instructions due to the hyperlinks to our GitHub wiki changing.

* Removed unused Parabola class

* Removed old license, added new unlicense (#594)

* Fixed issue with the License change (#599)

* Removed old license, added new unlicense

* Fixed cmake looking for license in the wrong place

* Added TestUtilities and used in Color tests

* Fixed an issue where app xmls were not being copied

* Tweaked IException test failure messages

* Updating TestUtilities.h and associated files to account for AssertIException to be broken into AssertIExceptionMessage and AssertIExceptionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants