Write CoreInterface unit test #5BRL-CAD
Status: ClosedTime to complete: 100 hrs Mentors: Mandeep Kaur, IshwerdasTags: unit test, library, oop, testing, C++

The C++ Object-oriented API, called CoreInterface aims to provide an easier-to-use, object-oriented interface over the already very powerful set of BRL-CAD tools some of the primitives(classes representing objects have already been written)

You can check out the core interface code from our subversion repository: svn checkout https://svn.code.sf.net/p/brlcad/code/rt^3/trunk rt^3

Your task is to write a unit test for the torus primitive. It should be put in /rt^3/tests/

Code:

  • rt^3/src/coreInterface/Torus.cpp
  • rt^3/include/brlcad/Torus.h

Please upload your work in a svn patch(diff) format: svn diff rt^3 my_changes.patch

References:
  • rt^3/tests/halfspace.cpp
  • rt^3/tests/primitives.cpp
  • rt^3/tests/PrintTitle.cpp
Modify:
  • rt^3/tests/torus.cpp -- you create this
  • rt^3/tests/CMakeLists.txt -- add your new file in here
Uploaded Work
File name/URLFile sizeDate submitted
torus.cpp6.1 KBDecember 22 2014 15:22 UTC
torus.patch7.3 KBDecember 23 2014 19:38 UTC
Comments
Yashon December 19 2014 14:06 UTCTask Claimed

I would like to work on this task.

Ch3ck on December 19 2014 14:09 UTCTask Assigned

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

Yashon December 20 2014 14:38 UTCClaim Removed

The claim on this task has been removed, someone else can claim it now.

Marc Tannouson December 22 2014 07:19 UTCTask Claimed

I would like to work on this task.

Sean on December 22 2014 07:24 UTCTask Assigned

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

Marc Tannouson December 22 2014 07:26 UTCQuick question

Sean, could you join IRC for a second? We were discussing about js canvas a few weeks ago about basic primitives in 2D with randomized gravity that would look good, I think I found something.


Regards,


Marc

Marc Tannouson December 22 2014 15:27 UTCLack of patch

Sorry for the lack of patch, I will not be able to access my Linux distro for a while, I just wrote the code in a Windows IDE, and explained everything I've done in comments, I consider I documented it nicely.


In regards to integration within the project : this goes into /tests/coreInterface as torus.cpp .


The following files are to be modified : CMakeLists.txt :


 set (ciTests_SRC


  halfspace.cpp


  primitives.cpp


sphere.cpp


cone.cpp


        torus.cpp


 )


Primitives.cpp :


if (database.Load(argv[1])) {


  test_halfspace(database);


test_sphere(database);


       test_cone(database);


                test_torus(database);


Primitives.h :


void test_halfspace(BRLCAD::Database database);


void test_sphere(BRLCAD::Database database);


 


void test_cone(BRLCAD::Database database);


void test_torus(BRLCAD::Databse database);


Regards,


Marc

Marc Tannouson December 22 2014 15:27 UTCReady for review

The work on this task is ready to be reviewed.

Sean on December 23 2014 09:03 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.

Sean on December 23 2014 09:10 UTCpatch and more

I think patch format will indeed help reviewing this kind of change where multiple files are affected.


Some minor stylistic points to work on in the meantime since your patches are maturing:



  • use "if (expression)" not "if( expression )" and not "if ( expression )" and not "if(expression)" ... basically be consistent with the rest of the logic in the other files

  • using "if (whatever==1)" on functions that return truthfully (0 is false, non-0 is true) is unnecessary, use "if (whatever)"

  • usually improves readability to have spaces around operators (see , and and == and = in particular)


 

Marc Tannouson December 23 2014 19:38 UTCReady for review

The work on this task is ready to be reviewed.

Daniel_R on December 24 2014 12:22 UTCIt doesn't compile

There are some basic mistakes in your code.  You would have seen them if you would have tried to compile it.


However, you put a lot of effort in creating this patch and I will close it.  There will be some follow-on tasks for fixing the bugs in your code.  I would recommend to wait for and picking one of them first than taking another bone from this series.

Daniel_R on December 24 2014 12:22 UTCTask Closed

Congratulations, this task has been completed successfully.