Guest User

Untitled

a guest
Dec 26th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. static int testSphereSet(BRLCAD::Sphere sph, Vector3D center, Vector3D height, double radius)
  2. {
  3.     sph.Set(center,height,radius);
  4.     // test stuff here
  5.         return 0; // if test passed
  6.     return 1;
  7. }
  8. static int testSphereSetRadius(BRLCAD::Sphere sph, double radius)
  9. {
  10.     sph.Set(radius);
  11.     //test stuff here
  12.         return 0;
  13.     return 1;
  14. }
  15. static int testSphereType(BRLCAD::Sphere sph)
  16. {
  17.     if(sph.Type()=="Sphere") return 0;
  18.     return 1;
  19. }
  20. void main(int argc, char* argv[])
  21. {
  22.     if(argc==7) // only run tests if we have 7 parametres
  23.     {  
  24.         bool ok=0;
  25.         double radius;
  26.         Vector3D center,height;
  27.         center.coordinates[0]=argv[0];
  28.         center.coordinates[1]=argv[1];
  29.         center.coordinates[2]=argv[2];
  30.         height.coordinates[0]=argv[3];
  31.         height.coordinates[1]=argv[4];
  32.         height.coordinates[2]=argv[5];
  33.         radius=argv[6];
  34.         if (testSphereSet(sph,center,height,radius))
  35.         {
  36.              std::cout <<"Test failed at function : Set";
  37.              ok=1;
  38.         }
  39.         if (testSphereSetRadius(sph,radius))
  40.         {
  41.             std::cout <<"Test failed at function : SetRadius";
  42.             ok=1;
  43.         }
  44.         if (testSphereType(sph))
  45.         {
  46.             std::cout <<"Test failed at function : Type";
  47.             ok=1;
  48.         }
  49.         if (ok==0 && sph.IsValid())
  50.             database.add(sph);
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment