Create numerics library (LIBBN) unit test for rand.cBRL-CAD
Status: ClosedTime to complete: 100 hrs Mentors: Isaac Kamga, Jacob BTags: C, testing, library, quality, api, unit test, assurance, math

There are more than 300 library functions 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

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 all of the public functions and be hooked into our build system. We have lots of existing unit tests to follow as an example.

Uploaded Work
File name/URLFile sizeDate submitted
rand.c1.3 KBDecember 03 2014 19:58 UTC
randpatch2.5 KBDecember 04 2014 12:45 UTC
Comments
Marc Tannouson December 3 2014 19:16 UTCTask Claimed

I would like to work on this task.

Deepak on December 3 2014 19:18 UTCTask Assigned

This task has been assigned to Marc Tannous. You have 100 hours to complete this task, good luck!

Marc Tannouson December 3 2014 19:58 UTCDid I understand the task correctly?

I have to create a unit test, similar to the others in the source code that tests all the public functions in rand.c .


In rand.c, there is only one public function, that is bn_mathtab_constant(); which turns all the elements in the specified interval into 0.0 . 


My code is really simple and just calls the function, which should set all the elements on 0.0 , if it does not then we have a problem and return 1, if it runs smoothly we return 0. There is no input required for this test, therefore I checked the argc to be appropriate.


Am I missing something? Is my source code correct?

Marc Tannouson December 3 2014 19:58 UTCReady for review

The work on this task is ready to be reviewed.

Popescu Andrei on December 4 2014 07:43 UTCLooks good

Hey, Marc!


 


The unit test looks good functionally use,  but you should submit it in patch format(SVN diff).


Also, please check  Coding Style Standards in the HACKING guide (http://svn.code.sf.net/p/brlcad/code/brlcad/trunk/HACKING)


Andrei

Popescu Andrei on December 4 2014 07:44 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.

Marc Tannouson December 4 2014 12:45 UTCReady for review

The work on this task is ready to be reviewed.

Popescu Andrei on December 4 2014 13:20 UTCTask Closed

Congratulations, this task has been completed successfully.

Popescu Andrei on December 4 2014 13:20 UTCGreat work!

Accepted! Great work!

Isaac Kamga on December 7 2014 11:10 UTCGood Job

Hi Marc, You did a good job on this task.