END_TEST


START_TEST ( test_LineSegment_createWithPoints )
{
   Point_t *start=new Point(LN,1.1,-2.2,3.3); 
   Point_t *end  =new Point(LN,-4.4,5.5,-6.6);

   LineSegment_t *ls=new LineSegment(LN, start,end);
   
   fail_unless( SBase_getTypeCode   ((SBase_t*) ls) == SBML_LAYOUT_LINESEGMENT );
   fail_unless( SBase_getMetaId     ((SBase_t*) ls) == NULL );
   
   Point_t *pos=LineSegment_getStart(ls);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(start));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(start));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(start));  
   
   pos=LineSegment_getEnd(ls);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(end));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(end));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(end));  

   Point_free(start);
   Point_free(end);

   LineSegment_free(ls);
  
}
Exemplo n.º 2
0
END_TEST


START_TEST ( test_LineSegment_createWithPoints )
{
   Point_t *start=Point_createWithCoordinates(1.1,-2.2,3.3); 
   Point_t *end  =Point_createWithCoordinates(-4.4,5.5,-6.6);

   LineSegment_t *ls=LineSegment_createWithPoints(start,end);
   
   fail_unless( SBase_getTypeCode   ((SBase_t*) ls) == SBML_LAYOUT_LINESEGMENT );
   fail_unless( SBase_getMetaId     ((SBase_t*) ls) == NULL );
//   fail_unless( SBase_getNotes      ((SBase_t*) ls) == NULL );
//   fail_unless( SBase_getAnnotation ((SBase_t*) ls) == NULL );

   fail_unless( LineSegment_isSetId(ls) == 0 );
   
   Point_t *pos=LineSegment_getStart(ls);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(start));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(start));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(start));  
   
   pos=LineSegment_getEnd(ls);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(end));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(end));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(end));  

   Point_free(start);
   Point_free(end);

   LineSegment_free(ls);
  
}
END_TEST

START_TEST ( test_LineSegment_createFrom )
{
   Point* start = new Point(LN,1.1,-2.2,3.3); 
   Point* end=new Point(LN,-4.4,5.5,-6.6); 
   LineSegment_setStart(LS,start);
   LineSegment_setEnd(LS,end);
   LineSegment_t* ls=LineSegment_createFrom(LS);
   
   
   fail_unless( SBase_getTypeCode   ((SBase_t*) ls) == SBML_LAYOUT_LINESEGMENT );
   
   if(SBase_isSetMetaId((SBase_t*)LS)){
     std::string c1=SBase_getMetaId((SBase_t*)LS);
     std::string c2=SBase_getMetaId((SBase_t*)ls);
     fail_unless( c1 == c2 );
   }
//   c1=SBase_getNotes((SBase_t*)LS);
//   c2=SBase_getNotes((SBase_t*)ls);
//   
//   if(SBase_isSetNotes((SBase_t*)LS))
//   {
//     fail_unless( strncmp(c1 , c2 ,strlen( c1 ) + 1 ) );
//   }
//   else
//   {
//     fail_unless(!(c1 || c2));
//   }
//   
//   c1=SBase_getAnnotation((SBase_t*)LS);
//   c2=SBase_getAnnotation((SBase_t*)ls);
//   
//   if(SBase_isSetAnnotation((SBase_t*)LS))
//   {
//     fail_unless( strncmp(c1 , c2 ,strlen( c1 ) + 1) );
//   }
//   else
//   {
//     fail_unless(!(c1 || c2));
//   }
   
   Point_t *pos=LineSegment_getStart(ls);
   Point_t *POS=LineSegment_getStart(LS);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));  
   
   pos=LineSegment_getEnd(ls);
   POS=LineSegment_getEnd(LS);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));  
 
   Point_free(start);
   Point_free(end);
   LineSegment_free(ls);
}
END_TEST

START_TEST ( test_CubicBezier_createWithPoints )
{
   Point_t *start= new (std::nothrow) Point(LN,1.1,-2.2,3.3); 
   Point_t *base1= new (std::nothrow) Point(LN,-0.5,2.4,5.6); 
   Point_t *base2= new (std::nothrow) Point(LN,7.8,-0.3,-1.2); 
   Point_t *end  = new (std::nothrow) Point(LN,-4.4,5.5,-6.6);

   CubicBezier_t *cb= new CubicBezier(LN,start,base1,base2,end);
   
   fail_unless( cb->getPackageName() == "layout");
   fail_unless( cb->getTypeCode() == SBML_LAYOUT_CUBICBEZIER);
   fail_unless( SBase_getMetaId     ((SBase_t*) cb) == NULL );

   Point_t *pos=CubicBezier_getStart(cb);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(start));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(start));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(start));  
   
   pos=CubicBezier_getBasePoint1(cb);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(base1));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(base1));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(base1));  

   pos=CubicBezier_getBasePoint2(cb);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(base2));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(base2));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(base2));  
   
   pos=CubicBezier_getEnd(cb);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(end));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(end));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(end));  

    Point_free(start);
    Point_free(base1);
    Point_free(base2);
    Point_free(end);
    CubicBezier_free(cb);
}
Exemplo n.º 5
0
END_TEST

START_TEST (test_LineSegment_setEnd ){
    Point_t *pos=Point_createWithCoordinates(-4.4,5.5,-6.6);
    LineSegment_setEnd(LS,pos);

    Point_t* POS=LineSegment_getEnd(LS);

    fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));
    fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));
    fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));
    Point_free(pos);
}
Exemplo n.º 6
0
END_TEST

START_TEST (test_LineSegment_setStart){
    Point_t *pos=Point_createWithCoordinates(1.1,-2.2,3.3);
    LineSegment_setStart(LS,pos);

    Point_t* POS=LineSegment_getStart(LS);

    fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));
    fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));
    fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS)); 
    Point_free(pos);
}
END_TEST

START_TEST (test_LineSegment_setEnd )
{
    Point_t *pos=new Point(LN,-4.4,5.5,-6.6);
    LineSegment_setEnd(LS,pos);

    Point_t* POS=LineSegment_getEnd(LS);

    fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));
    fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));
    fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));
    Point_free(pos);
}
END_TEST

START_TEST (test_CubicBezier_setEnd )
{
    Point_t *pos= new (std::nothrow) Point(LN,-4.4,5.5,-6.6);
    CubicBezier_setEnd(CB,pos);

    Point_t* POS=CubicBezier_getEnd(CB);

    fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));
    fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));
    fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));
    Point_free(pos);
}
END_TEST

START_TEST (test_CubicBezier_setBasePoint1 )
{
    Point_t *pos= new (std::nothrow) Point(LN,7.7,-8.8,9.9);
    CubicBezier_setBasePoint1(CB,pos);

    Point_t* POS=CubicBezier_getBasePoint1(CB);

    fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));
    fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));
    fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));
    Point_free(pos);
}
END_TEST

START_TEST (test_CubicBezier_setBasePoint2 )
{
    Point_t *pos= new (std::nothrow) Point(LN,-10.10,11.11,-12.12);
    CubicBezier_setBasePoint2(CB,pos);

    Point_t* POS=CubicBezier_getBasePoint2(CB);

    fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));
    fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));
    fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));

    Point_free(pos);
}
END_TEST

START_TEST (test_CubicBezier_setStart)
{
    Point_t *pos= new (std::nothrow) Point(LN,1.1,-2.2,3.3);
    CubicBezier_setStart(CB,pos);

    Point_t* POS=CubicBezier_getStart(CB);

    fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));
    fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));
    fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS)); 
    Point_free(pos);

}
Exemplo n.º 12
0
END_TEST

START_TEST ( test_LineSegment_createFrom )
{
   Point_t* start=Point_createWithCoordinates(1.1,-2.2,3.3); 
   Point_t* end=Point_createWithCoordinates(-4.4,5.5,-6.6); 
   LineSegment_setStart(LS,start);
   LineSegment_setEnd(LS,end);
   LineSegment_setId(LS,"TestID");
   LineSegment_t* ls=LineSegment_createFrom(LS);
   
   
   fail_unless( SBase_getTypeCode   ((SBase_t*) ls) == SBML_LAYOUT_LINESEGMENT );
   const char* c1=SBase_getMetaId((SBase_t*)LS);
   const char* c2=SBase_getMetaId((SBase_t*)ls);
   
   if(SBase_isSetMetaId((SBase_t*)LS)){
     fail_unless( strncmp(c1 , c2 ,strlen( c1 )+1 ) );
   }
   else
   {
     fail_unless(!(c1 || c2));
   }
//   c1=SBase_getNotes((SBase_t*)LS);
//   c2=SBase_getNotes((SBase_t*)ls);
//   
//   if(SBase_isSetNotes((SBase_t*)LS))
//   {
//     fail_unless( strncmp(c1 , c2 ,strlen( c1 ) + 1 ) );
//   }
//   else
//   {
//     fail_unless(!(c1 || c2));
//   }
//   
//   c1=SBase_getAnnotation((SBase_t*)LS);
//   c2=SBase_getAnnotation((SBase_t*)ls);
//   
//   if(SBase_isSetAnnotation((SBase_t*)LS))
//   {
//     fail_unless( strncmp(c1 , c2 ,strlen( c1 ) + 1) );
//   }
//   else
//   {
//     fail_unless(!(c1 || c2));
//   }
   
   fail_unless( LineSegment_isSetId(ls) == LineSegment_isSetId(LS) );
   if( LineSegment_isSetId(ls) )
   {
       c1=LineSegment_getId(LS);
       c2=LineSegment_getId(ls);
       fail_unless( strncmp(c1 , c2 ,strlen( c1 ) + 1 ) == 0);
     
   }
   
   Point_t *pos=LineSegment_getStart(ls);
   Point_t *POS=LineSegment_getStart(LS);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));  
   
   pos=LineSegment_getEnd(ls);
   POS=LineSegment_getEnd(LS);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));  
 
   Point_free(start);
   Point_free(end);
   LineSegment_free(ls);
}
Exemplo n.º 13
0
END_TEST

START_TEST ( test_Point_free_NULL)
{
  Point_free(NULL);
}
END_TEST

START_TEST ( test_CubicBezier_createFrom )
{
   Point_t* start= new (std::nothrow) Point(LN,1.1,-2.2,3.3);
   Point_t* base1= new (std::nothrow) Point(LN,-4.4,5.5,-6.6);
   Point_t* base2= new (std::nothrow) Point(LN,7.7,-8.8,9.9);
   Point_t* end= new (std::nothrow) Point(LN,-10.10,11.11,-12.12);
   CubicBezier_setStart(CB,start);
   CubicBezier_setBasePoint1(CB,base1);
   CubicBezier_setBasePoint2(CB,base2);
   CubicBezier_setEnd(CB,end);
   CubicBezier_t* cb=CubicBezier_createFrom(CB);
   fail_unless( cb->getPackageName() == "layout");
   fail_unless( cb->getTypeCode() == SBML_LAYOUT_CUBICBEZIER);
   if(SBase_isSetMetaId((SBase_t*)CB))
   {
	   std::string c1=SBase_getMetaId((SBase_t*)CB);
	   std::string c2=SBase_getMetaId((SBase_t*)cb);
       fail_unless( c1 == c2 );
   }

//   c1=SBase_getNotes((SBase_t*)CB);
//   c2=SBase_getNotes((SBase_t*)cb);
//   if(SBase_isSetNotes((SBase_t*)CB))
//   {
//       fail_unless( strncmp(c1 , c2 ,strlen( c1)+1 )==0 );
//   }
//   else{
//       fail_unless(!(c1 || c2));
//   }

//   c1=SBase_getAnnotation((SBase_t*)CB);
//   c2=SBase_getAnnotation((SBase_t*)cb);
//   if(SBase_isSetAnnotation((SBase_t*)CB))
//   {
//       fail_unless( strncmp(c1 , c2 ,strlen( c1)+1 )==0 );
//   }
//   else{
//       fail_unless(!(c1 || c2));
//   }

   Point_t *pos=CubicBezier_getStart(cb);
   Point_t *POS=CubicBezier_getStart(CB);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));  

   pos=CubicBezier_getBasePoint1(cb);
   POS=CubicBezier_getBasePoint1(CB);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));  
   
   pos=CubicBezier_getBasePoint2(cb);
   POS=CubicBezier_getBasePoint2(CB);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));  
    
   pos=CubicBezier_getEnd(cb);
   POS=CubicBezier_getEnd(CB);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS));  
   fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS));  
   fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS));  
   Point_free(start);
   Point_free(base1);
   Point_free(base2);
   Point_free(end);

  CubicBezier_free(cb); 
}