Create unit tests for our numerics math library (LIBBN) #5BRL-CAD
Status: ClosedTime to complete: 72 hrs Mentors: Gauravjeet SinghTags: C, unit test, math

There are dozens of files in our core LIBBN library. As a core library used by nearly every one of BRL-CAD's tools, testing those functions for correct behavior is important.

References:

  • include/bn.h
  • include/plot3.h
  • include/vmath.h
  • src/libbn/rand.c
  • src/libbu/tests/*.c (note libbu, not libbn for examples)
  • src/libbn/tests/*.c (also many examples, but not as good)

Code:

  • src/libbn/tests/rand.c
  • src/libbn/tests/CMakeLists.txt

This task involves implementing a new unit test for any of LIBBN's source files that do not already have a unit test defined.  The test should run at least 10 public functions if there are multiple functions defined within one of our source files.

Some files, like our mat.c file, have LOTS of functions.  You don't have to test them all!  Just test at least 10 of them and if any prove to be challenging, let us know before you invest more than an hour.  Your unit test(s) must be hooked into our build system and "should" pass.  If you find a genuine bug, let us know (we can create follow-on tasks for any you investigate and fix).  We have lots of existing unit tests to follow as an example.

Submit your new unit test and build system changes as a patch file.  Let us know about any problems or bugs encountered.

Uploaded Work
File name/URLFile sizeDate submitted
mat-tests.patch18.7 KBDecember 23 2013 02:10 UTC
mat-tests2.patch18.7 KBDecember 23 2013 02:12 UTC
mat-tests3.patch18.1 KBDecember 23 2013 09:21 UTC
Comments
agkphysicson December 22 2013 11:16 UTCTask Claimed

I would like to work on this task.

Mandeep Kaur on December 22 2013 12:10 UTCTask Assigned

This task has been assigned to agkphysics. You have 72 hours to complete this task, good luck!

agkphysicson December 23 2013 02:13 UTCReady for review

The work on this task is ready to be reviewed.

agkphysicson December 23 2013 02:15 UTCAll tests pass

When I compile and test, all mat tests pass.


The patch is mat-tests2.patch - There was a mistake in the title of mat-tests.patch.

agkphysicson December 23 2013 02:17 UTCBTW

I used a combination of Wolfram Alpha and this website to help me insert appropriate values to the testing functions.

Sean on December 23 2013 08:51 UTClooks good

This looks good, but you should cite those two sources you used for referene values in a comment in those files somewhere.  That way, future devs will have an inclination where the numbers came from if they need to re-verify or change something.

Sean on December 23 2013 08:52 UTCTask Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

agkphysicson December 23 2013 09:25 UTCReady for review

The work on this task is ready to be reviewed.

Sean on December 23 2013 18:51 UTCTask Closed

Congratulations, this task has been completed successfully.

Sean on December 23 2013 19:06 UTCLooks good

Looks good, go ahead and commit. ;)