Skip to content

Conversation

jewettaij
Copy link
Contributor

@jewettaij jewettaij commented Dec 5, 2019

Although it might seem unnecessary for such a small project, I have found automatic testing to be helpful for my work. If you accept this pull request, then every time you push a commit to github, travis-ci.org will start a virtual machine which will 1) compile lambda_lanczos_test and 2) run it (using two different compilers: g++ and clang++). If the code fails to compile, or if any of the "assert" statements in lambda_lanczos_test.cpp fail, then travis will send you a warning by email. I also added some "badges" to the README.md file, so that any of your tests (in the master branch) fail, everyone else will know also (!).

To make this work, you will have to visit https://travis-ci.org. (I think you can log in using your github password.) You will see a list of the repositories you have on github. Select "lambda-lanczos", and click on the "Activate" button in the middle of the screen. Then to test whether everything is working create a new commit. If everything is working, you will see a green rectangle at the top of your README.md file. (See example below). I tested it on my fork of your repository and it was working. However you will have to make sure your account is setup with travis-ci.org first.

You may want to add more assert statements to lambda_lanczos_test.cpp. (I was not very rigorous.)

You don't have to accept this pull request. But I thought I would show you how to add automatic testing to a github repository because it was so helpful for me. (I just learned how to do it recently.)

Thank you again very much for your help.
-Andrew

@jewettaij
Copy link
Contributor Author

Note:
If decide to change the include path (#4), you will also have to change the .travis.yml file. There are two lines you would need to modify. These two lines invoke g++ and also clang++ to compile the *lambda_lanczos_test" program. (If you change the include path, you will probably need to modify the "-I" arguments here.)

@jewettaij
Copy link
Contributor Author

jewettaij commented Dec 6, 2019

This is what it should look like when everything is working:
example_build_passing

(There are more silly badges here.)

@mrcdr
Copy link
Owner

mrcdr commented Dec 8, 2019

Thank you for your suggestion.

I also think my code is a bit small, but testing is important for any project.
I know Travis CI (because many repos show the badges), but I've never tried it.
Recently, I used GoogleTest on another project and
it was useful (I found some articles explaining how to combine GoogleTest and Travis CI) .
So I'm currently planning to rewrite my test code with it.
(I may also reconstruct building environment to use cmake instead of make)

I'm very sorry not to accept your pull request because I still would like to avoid use of Set()s.
But your suggestion will be helpful after my test code rewritten.

Many thanks

@jewettaij
Copy link
Contributor Author

jewettaij commented Dec 8, 2019

No problem! Because you already wrote a test program (lambda_lanczos_test), it was easy for me to modify it to make it work with travis. So it will be easy for you to use a different testing framework. (Thanks for letting me know about GoogleTest.)

@jewettaij jewettaij closed this Dec 8, 2019
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.

2 participants