コード例 #1
0
int
main (void) 
{ 
  int num_failed;

  setTestDataDirectory();

  SRunner *runner = srunner_create( create_suite_Point() );

  srunner_add_suite( runner, create_suite_Dimensions            () );
  srunner_add_suite( runner, create_suite_BoundingBox           () );
  srunner_add_suite( runner, create_suite_LineSegment           () );
  srunner_add_suite( runner, create_suite_CubicBezier           () );
  srunner_add_suite( runner, create_suite_Curve                 () );
  srunner_add_suite( runner, create_suite_GraphicalObject       () );
  srunner_add_suite( runner, create_suite_CompartmentGlyph      () );
  srunner_add_suite( runner, create_suite_SpeciesGlyph          () );
  srunner_add_suite( runner, create_suite_ReactionGlyph         () );
  srunner_add_suite( runner, create_suite_SpeciesReferenceGlyph () );
  srunner_add_suite( runner, create_suite_TextGlyph             () );
  srunner_add_suite( runner, create_suite_Layout                () );
  srunner_add_suite( runner, create_suite_LayoutCreation        () );
  srunner_add_suite( runner, create_suite_LayoutFormatter       () );
  srunner_add_suite( runner, create_suite_SBMLHandler           () );
  srunner_add_suite( runner, create_suite_LayoutWriting         () );
 /* srunner_add_suite( runner, create_suite_Misc                  () ); */


#ifdef TRACE_MEMORY
  srunner_set_fork_status(runner, CK_NOFORK);
#endif

  srunner_run_all(runner, CK_NORMAL);
  num_failed = srunner_ntests_failed(runner);

#ifdef TRACE_MEMORY

  if (MemTrace_getNumLeaks() > 0)
  {
    MemTrace_printLeaks(stdout);
  }

  MemTrace_printStatistics(stdout);

#endif

  srunner_free(runner);

  return num_failed;
}
コード例 #2
0
ファイル: TestRunner.c プロジェクト: kirichoi/roadrunner
int
main (void) 
{ 
  int num_failed;

  setTestDataDirectory();

  SRunner *runner = srunner_create( create_suite_UtilsUnit() );

  srunner_add_suite( runner, create_suite_UtilsUnitDefinition  () );
  srunner_add_suite( runner, create_suite_UnitFormulaFormatter () );
  srunner_add_suite( runner, create_suite_UnitFormulaFormatter1() );
  srunner_add_suite( runner, create_suite_FormulaUnitsData() );
  srunner_add_suite( runner, create_suite_DerivedUnitDefinition() );
  srunner_add_suite( runner, create_suite_UnitFormulaFormatter2() );
  srunner_add_suite( runner, create_suite_CalcUnitDefinition() );
  srunner_add_suite( runner, create_suite_UnitFormulaFormatter3() );
  


#ifdef TRACE_MEMORY
  srunner_set_fork_status(runner, CK_NOFORK);
#endif

  srunner_run_all(runner, CK_NORMAL);
  num_failed = srunner_ntests_failed(runner);

#ifdef TRACE_MEMORY

  if (MemTrace_getNumLeaks() > 0)
  {
    MemTrace_printLeaks(stdout);
  }

  MemTrace_printStatistics(stdout);

#endif

  srunner_free(runner);

  safe_free(TestDataDirectory);

  return num_failed;
}
コード例 #3
0
ファイル: memory.c プロジェクト: Alcibiades586/roadrunner
/**
 * Prints the file and line number of all memory leaks that have occurred
 * in this program up to this point.  Output is sent to stream.
 */
void
MemTrace_printLeaks (FILE *stream)
{
  unsigned int  leaks = MemTrace_getNumLeaks();
  unsigned int  total = 0;
  MemInfoNode_t *node = NULL;


  fprintf(stream, "\nMemory Leaks:\n");

  for (node = MemTrace_AllocList->head; node != NULL; node = node->next)
  {
    total += node->size;

    fprintf( stream,
             "  In file %s at line %d (%d bytes leaked)\n",
             node->filename,
             node->line,
             node->size );
  }

  fprintf(stream, "Total Leaks: %d ", leaks);

  if (total > 1048576)
  {
    fprintf(stream, "(%4.1f M", ((float) total) / 1048576);
  }
  else if (total > 1024)
  {
    fprintf(stream, "(%4.1f K", ((float) total) / 1024);
  }
  else
  {
    fprintf(stream, "(%d ", total);
  }

  fprintf(stream, "bytes leaked)\n");
}
コード例 #4
0
ファイル: memory.c プロジェクト: Alcibiades586/roadrunner
/**
 * Prints the current memory trace statistics to the given stream.
 */
void
MemTrace_printStatistics (FILE *stream)
{
  unsigned int allocs    = MemTrace_getNumAllocs();
  unsigned int leaks     = MemTrace_getNumLeaks();
  unsigned int frees     = MemTrace_getNumFrees();
  unsigned int unmatched = MemTrace_getNumUnmatchedFrees();

  float percent;


  fprintf(stream, "\nMemory Trace Statistics:\n");

  if (allocs == frees)
  {
    fprintf(stream, "100%%: ");
  }
  else if (allocs == 0)
  {
    fprintf(stream, "0%%: ");
  }
  else
  {
    if (allocs > frees)
    {
      percent = ((float) frees / allocs) * 100;
    }
    else
    {
      percent = ((float) allocs/ frees) * 100;
    }

    fprintf(stream, "%4.1f%%: ", percent);
  }

  fprintf(stream, "Allocs: %d, Frees: %d, Leaks: %d, ", allocs, frees, leaks);
  fprintf(stream, "Unmatched Frees: %d\n", unmatched);
}
コード例 #5
0
int
main (int argc, char* argv[]) 
{ 
  int num_failed;

  setTestDataDirectory();

  SRunner *runner = srunner_create( create_suite_ReadSBML               () );
  srunner_add_suite( runner, create_suite_SBMLValidatorAPI              () );
  srunner_add_suite( runner, create_suite_RenameIDs                     () );
  srunner_add_suite( runner, create_suite_RemoveFromParent              () );
  srunner_add_suite( runner, create_suite_GetMultipleObjects            () );
  srunner_add_suite( runner, create_suite_WriteSBML                     () );
  srunner_add_suite( runner, create_suite_WriteL3SBML                   () );
  srunner_add_suite( runner, create_suite_WriteL3V2SBML                 () );
  srunner_add_suite( runner, create_suite_AlgebraicRule                 () ); 
  srunner_add_suite( runner, create_suite_AssignmentRule                () );
  srunner_add_suite( runner, create_suite_Compartment                   () );
  srunner_add_suite( runner, create_suite_L3_Compartment                () );
  srunner_add_suite( runner, create_suite_Compartment_newSetters        () );
  srunner_add_suite( runner, create_suite_CompartmentType               () );
  srunner_add_suite( runner, create_suite_CompartmentType_newSetters    () );
  srunner_add_suite( runner, create_suite_CompartmentVolumeRule         () );
  srunner_add_suite( runner, create_suite_Constraint                    () );
  srunner_add_suite( runner, create_suite_Constraint_newSetters         () );
  srunner_add_suite( runner, create_suite_Delay                         () );
  srunner_add_suite( runner, create_suite_Event                         () );
  srunner_add_suite( runner, create_suite_L3_Event                      () );
  srunner_add_suite( runner, create_suite_Event_newSetters              () );
  srunner_add_suite( runner, create_suite_EventAssignment               () );
  srunner_add_suite( runner, create_suite_EventAssignment_newSetters    () );
  srunner_add_suite( runner, create_suite_FunctionDefinition            () );
  srunner_add_suite( runner, create_suite_FunctionDefinition_newSetters () );
  srunner_add_suite( runner, create_suite_InitialAssignment             () );
  srunner_add_suite( runner, create_suite_InitialAssignment_newSetters  () );
  srunner_add_suite( runner, create_suite_KineticLaw                    () );
  srunner_add_suite( runner, create_suite_KineticLaw_newSetters         () );
  srunner_add_suite( runner, create_suite_L3_KineticLaw                 () );
  srunner_add_suite( runner, create_suite_ListOf                        () );
  srunner_add_suite( runner, create_suite_Model                         () );
  srunner_add_suite( runner, create_suite_L3_Model                      () );
  srunner_add_suite( runner, create_suite_Model_newSetters              () );
  srunner_add_suite( runner, create_suite_ModifierSpeciesReference      () );
  srunner_add_suite( runner, create_suite_Parameter                     () );
  srunner_add_suite( runner, create_suite_L3_Parameter                  () );
  srunner_add_suite( runner, create_suite_L3_LocalParameter             () );
  srunner_add_suite( runner, create_suite_Parameter_newSetters          () );
  srunner_add_suite( runner, create_suite_ParameterRule                 () );
  srunner_add_suite( runner, create_suite_Priority                      () );
  srunner_add_suite( runner, create_suite_RateRule                      () );
  srunner_add_suite( runner, create_suite_Reaction                      () );
  srunner_add_suite( runner, create_suite_L3_Reaction                   () );
  srunner_add_suite( runner, create_suite_Reaction_newSetters           () );
  srunner_add_suite( runner, create_suite_Rule                          () );
  srunner_add_suite( runner, create_suite_Rule_newSetters               () );
  srunner_add_suite( runner, create_suite_SBase                         () );
  srunner_add_suite( runner, create_suite_SBase_newSetters              () );
  srunner_add_suite( runner, create_suite_Species                       () );
  srunner_add_suite( runner, create_suite_L3_Species                    () );
  srunner_add_suite( runner, create_suite_Species_newSetters            () );
  srunner_add_suite( runner, create_suite_SpeciesReference              () );
  srunner_add_suite( runner, create_suite_L3_SpeciesReference           () );
  srunner_add_suite( runner, create_suite_SpeciesReference_newSetters   () );
  srunner_add_suite( runner, create_suite_SpeciesConcentrationRule      () );
  srunner_add_suite( runner, create_suite_SpeciesType                   () );
  srunner_add_suite( runner, create_suite_SpeciesType_newSetters        () );
  srunner_add_suite( runner, create_suite_StoichiometryMath             () );
  srunner_add_suite( runner, create_suite_Trigger                       () );
  srunner_add_suite( runner, create_suite_L3Trigger                     () );
  srunner_add_suite( runner, create_suite_Unit                          () );
  srunner_add_suite( runner, create_suite_L3_Unit                       () );
  srunner_add_suite( runner, create_suite_Unit_newSetters               () );
  srunner_add_suite( runner, create_suite_UnitDefinition                () );
  srunner_add_suite( runner, create_suite_UnitDefinition_newSetters     () );
  srunner_add_suite( runner, create_suite_UnitKind                      () );
  srunner_add_suite( runner, create_suite_CopyAndClone                  () );
  srunner_add_suite( runner, create_suite_SBMLConvert                   () );
  srunner_add_suite( runner, create_suite_SBMLConvertStrict             () );
  srunner_add_suite( runner, create_suite_SBMLConvertFromL3V2           () );
  srunner_add_suite( runner, create_suite_SBMLDocument                  () );
  srunner_add_suite( runner, create_suite_SBMLError                     () );
  srunner_add_suite( runner, create_suite_TestReadFromFile1             () );
  srunner_add_suite( runner, create_suite_TestReadFromFile2             () );
  srunner_add_suite( runner, create_suite_TestReadFromFile3             () );
  srunner_add_suite( runner, create_suite_TestReadFromFile4             () );
  srunner_add_suite( runner, create_suite_TestReadFromFile5             () );
  srunner_add_suite( runner, create_suite_TestReadFromFile6             () );
  srunner_add_suite( runner, create_suite_TestReadFromFile7             () );
  srunner_add_suite( runner, create_suite_TestReadFromFile8             () );
  srunner_add_suite( runner, create_suite_TestReadFromFile9             () );
  srunner_add_suite( runner, create_suite_TestReadFromFileL2V5          () );
  srunner_add_suite( runner, create_suite_TestReadFromFileL3V2          () );
  srunner_add_suite( runner, create_suite_TestReadFromFileL3V2_1        () );
  srunner_add_suite( runner, create_suite_TestReadFromFileL3V2_2        () );
  srunner_add_suite( runner, create_suite_TestReadFromFileL3V2_3        () );
  srunner_add_suite( runner, create_suite_TestReadFromFileL3V2_4        () );
  srunner_add_suite( runner, create_suite_TestReadFromFileL3V2_5        () );
  srunner_add_suite( runner, create_suite_TestReadFromFileL3V2_6        () );
  srunner_add_suite( runner, create_suite_TestConsistencyChecks         () );
  srunner_add_suite( runner, create_suite_ParentObject                  () );
  srunner_add_suite( runner, create_suite_AncestorObject                () );
  srunner_add_suite( runner, create_suite_TestInternalConsistencyChecks () );
  srunner_add_suite( runner, create_suite_HasReqdAtt                    () );
  srunner_add_suite( runner, create_suite_HasReqdElements               () );
  srunner_add_suite( runner, create_suite_SBMLNamespaces                () );
  srunner_add_suite( runner, create_suite_SyntaxChecker                 () );
  srunner_add_suite( runner, create_suite_SBMLConstructorException      () );
  srunner_add_suite( runner, create_suite_SBMLTransforms                () );
  srunner_add_suite( runner, create_suite_GetMultipleObjects            () );
  srunner_add_suite( runner, create_suite_LevelCompatibility            () );
  srunner_add_suite( runner, create_suite_SBase_IdName                   () );
  srunner_add_suite( runner, create_suite_Attributes                   () );

#ifdef TRACE_MEMORY
  srunner_set_fork_status(runner, CK_NOFORK);
#else
  if (argc > 1 && !strcmp(argv[1], "-nofork"))
  {
    srunner_set_fork_status( runner, CK_NOFORK );
  }
#endif

  srunner_run_all(runner, CK_NORMAL);
  num_failed = srunner_ntests_failed(runner);

#ifdef TRACE_MEMORY

  if (MemTrace_getNumLeaks() > 0)
  {
    MemTrace_printLeaks(stdout);
  }

  MemTrace_printStatistics(stdout);

#endif

  srunner_free(runner);
  safe_free(TestDataDirectory);

  return num_failed;
}