Assignment 3: Testing and Version Control
A modularized version of the hydrogen code can be found in the zip file below. Your assignment is to create tests for this code base.
For this assignment, you will have to use git and catch2. We explained in class how to get git on your computer, but you will have to install the Catch2 Libraries using cmake starting from the catch2 source code on https://github.com/catchorg/Catch2.
While proceeding with this assignment, we expect you to use git version control and make regular git commits to track the code. Therefore, you must first put the code into version control with git in the same directory as the code. Use one single git repository for the whole assignment.
The code already comes with one unit test with only one test case for the output module (the one showed in class), which you can run by typing 'make outputtest', but you have to implement further tests:
- Add another test case to the testsuite for the output module for the writeBinary function. (A testsuite here is a single file with several test)
- A unit testsuite with some test cases for the init module.
- A unit testsuite with some test cases for the eigenval module.
- An integrated test for the whole code.
Be sure to write separate rules in the Makefile to compile and run the unit tests of each module and a overall rule called "test" to run all three unit test programs and the integrated test.
Some tips on what to test for the init module, keep in mind init() only works if the input is the third power of an odd number, e.g. n=1, 27, 125, 343, etc. For n=0, the routine will return an empty matrix. For n=1, the matrix element has the value -97/2500.
For the tests of the eigenval module, you may use that the ground state energy of the matrix {{-1,1},{2,0}} is -2. The groundstate of the identity matrix is 1, while the ground state of a diagonal matrix is its smallest element. The function will fail for the matrix {{1,1},{2,0}}.
Note that we expect to see several commits, and meaningful comments, and that all source files in that directory are added to the repo.
Submit your code including with the .git repo directory as a single zip or tar file by Thursday February 6, 2025 at midnight.
- 30 January 2025, 11:50 PM