コード例 #1
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);
  
}
コード例 #2
0
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);
  
}
コード例 #3
0
END_TEST

START_TEST ( test_LineSegment_createWithPoints_NULL )
{
   LineSegment_t *ls=LineSegment_createWithPoints(NULL,NULL);
   
   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) == 0.0);  
   fail_unless(Point_getYOffset(pos) == 0.0);  
   fail_unless(Point_getZOffset(pos) == 0.0);  
   
   pos=LineSegment_getEnd(ls);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == 0.0);  
   fail_unless(Point_getYOffset(pos) == 0.0);  
   fail_unless(Point_getZOffset(pos) == 0.0);  
 
   LineSegment_free(ls);
}
コード例 #4
0
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);
}
コード例 #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);
}
コード例 #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);
}
コード例 #7
0
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);
}
コード例 #8
0
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);
}
コード例 #9
0
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);
}
コード例 #10
0
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);
}
コード例 #11
0
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);

}
コード例 #12
0
END_TEST

START_TEST (test_LineSegment_setEnd_NULL )
{
    LineSegment_setEnd(LS,NULL);
    Point_t *pos=LineSegment_getEnd(LS);
    fail_unless(pos != NULL);
    fail_unless(Point_getXOffset(pos) == 0.0);
    fail_unless(Point_getYOffset(pos) == 0.0);
    fail_unless(Point_getZOffset(pos) == 0.0);
}
コード例 #13
0
END_TEST

START_TEST ( test_CubicBezier_createWithPoints_NULL )
{
	Point* nullPoint = NULL;
   CubicBezier_t *cb=new CubicBezier(LN,
									 nullPoint,
									 nullPoint,
									 nullPoint,
									 nullPoint);
   
   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) == 0.0);  
   fail_unless(Point_getYOffset(pos) == 0.0);  
   fail_unless(Point_getZOffset(pos) == 0.0);  
   
   pos=CubicBezier_getBasePoint1(cb);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == 0.0);  
   fail_unless(Point_getYOffset(pos) == 0.0);  
   fail_unless(Point_getZOffset(pos) == 0.0);  

   pos=CubicBezier_getBasePoint2(cb);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == 0.0);  
   fail_unless(Point_getYOffset(pos) == 0.0);  
   fail_unless(Point_getZOffset(pos) == 0.0);  
   
   pos=CubicBezier_getEnd(cb);
   fail_unless(pos != NULL);
   fail_unless(Point_getXOffset(pos) == 0.0);  
   fail_unless(Point_getYOffset(pos) == 0.0);  
   fail_unless(Point_getZOffset(pos) == 0.0);  
 
   CubicBezier_free(cb);
}
コード例 #14
0
END_TEST


START_TEST (test_CubicBezier_setEnd_NULL )
{
    CubicBezier_setEnd(CB,NULL);
    Point_t *pos=CubicBezier_getEnd(CB);
    fail_unless(pos != NULL);
    fail_unless(Point_getXOffset(pos) == 0.0);
    fail_unless(Point_getYOffset(pos) == 0.0);
    fail_unless(Point_getZOffset(pos) == 0.0);
}
コード例 #15
0
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);
}
コード例 #16
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);
}
コード例 #17
0
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); 
}