GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

GATTestUtils.h File Reference

Header file for certain test helper macros used by the GAT unit tests. More...

#include <stdio.h>

Include dependency graph for GATTestUtils.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define GAT_EXIT_ON_ERROR   0
#define _GAT_TESTS   0
#define TEMP   "/tmp/"
#define GAT_PREFIX_SUITE   "------- %s -------\n"
#define GAT_PREFIX_LINE   "Test : %-45s \t : "
#define GAT_PREFIX_NLINE   " %-45s \t : "
#define GAT_POSTFIX_EEXIT   "- %3d ERRORs\n"
#define GAT_POSTFIX_SEXIT   "- SUCCESS\n"
#define GAT_PREFIX_ERRLINE   "- ERROR : %s +%d\n", __FILE__, __LINE__
#define GAT_PREFIX_DEBUG   "\n %s\n"
#define GAT_TEST_INIT(x)
#define GAT_TEST_FINISH()   _GAT_TEST_FINISH (rcsid)
#define GAT_TEST_SUITE(x)
#define GAT_TEST_START(x)
#define GAT_TEST_STOP()
#define GAT_TEST_EXIT()
#define GAT_TEST(y)
#define GAT_TEST_TRACE(y, context)
#define GAT_DEBUG(x)

Functions

int _GAT_TEST_INIT (int t)
 initialize test suite - internal

void _GAT_TEST_FINISH (const char *rcs)
 finish test suite - internal

const char * GATTest_GetTempDirName (void)
 get name for temp directory checks for ENV{TEMP}, and creates dir if needed

const char * GATTest_GetTempFileName (const char *name)
 get name for temp file in temp dir

const char * GATTest_CreateTempFile (const char *name)
 creates the temp file given, and filles with some dummy data

const char * GATTest_GetTempFileNameF (const char *format,...)
 same as abve, but allows printf like spec of file name - useful for file enumeration etc.

int GATTest_GetIndent (void)
 get number of spaces for print indenting

void GATTest_SetIndent (int indent)
 set number of spaces for print indenting

int GATTest_GetError (void)
 get current error value

void GATTest_SetError (int error)
 set current error value


Detailed Description

Header file for certain test helper macros used by the GAT unit tests.

Date:
Mon Dec 01 2003
Version:
Header:
/export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATTestUtils.h,v 1.10 2004/04/02 12:31:58 hartmutkaiser Exp

Copyright (C) Andre Merzky This file is part of the GAT Engine. Contributed by Andre Merzky <merzky [at] zib [dot] de>.

Use, modification and distribution is subject to the Gridlab Software License. (See accompanying file GLlicense.txt or copy at http://www.gridlab.org/GLlicense.txt)

Definition in file GATTestUtils.h.


Define Documentation

#define GAT_EXIT_ON_ERROR   0
 

Definition at line 22 of file GATTestUtils.h.

#define _GAT_TESTS   0
 

Definition at line 27 of file GATTestUtils.h.

#define TEMP   "/tmp/"
 

Definition at line 31 of file GATTestUtils.h.

Referenced by GATTest_GetTempDirName().

#define GAT_PREFIX_SUITE   "------- %s -------\n"
 

Definition at line 55 of file GATTestUtils.h.

#define GAT_PREFIX_LINE   "Test : %-45s \t : "
 

Definition at line 56 of file GATTestUtils.h.

#define GAT_PREFIX_NLINE   " %-45s \t : "
 

Definition at line 57 of file GATTestUtils.h.

#define GAT_POSTFIX_EEXIT   "- %3d ERRORs\n"
 

Definition at line 58 of file GATTestUtils.h.

#define GAT_POSTFIX_SEXIT   "- SUCCESS\n"
 

Definition at line 59 of file GATTestUtils.h.

#define GAT_PREFIX_ERRLINE   "- ERROR : %s +%d\n", __FILE__, __LINE__
 

Definition at line 60 of file GATTestUtils.h.

#define GAT_PREFIX_DEBUG   "\n %s\n"
 

Definition at line 61 of file GATTestUtils.h.

#define GAT_TEST_INIT  
 

Value:

{                                                \
  if ( ! _GAT_TEST_INIT (_GAT_TESTS) )                                    \
  {                                                                       \
    return (x);                                                           \
  }                                                                       \
}

Definition at line 63 of file GATTestUtils.h.

Referenced by main().

 
#define GAT_TEST_FINISH      _GAT_TEST_FINISH (rcsid)
 

Definition at line 70 of file GATTestUtils.h.

Referenced by main().

#define GAT_TEST_SUITE  
 

Value:

{                                               \
    if ( GATTest_GetIndent() )                                            \
    {                                                                     \
      GATTest_SetIndent(0);                                               \
      GATTest_SetError(0);                                                \
    }                                                                     \
    fprintf (stderr,     GAT_PREFIX_SUITE, x);                            \
    fflush  (stderr);                                                     \
  }

Definition at line 72 of file GATTestUtils.h.

Referenced by main().

#define GAT_TEST_START  
 

Value:

{                                               \
    if ( ! GATTest_GetIndent() )                                          \
    {                                                                     \
      fprintf (stderr,   GAT_PREFIX_LINE, x);                             \
      fflush  (stderr);                                                   \
      GATTest_SetError(0);                                                \
    }                                                                     \
    GATTest_SetIndent(GATTest_GetIndent() +1);                            \
  }                                                                       \
                                                                          \
  {

Definition at line 82 of file GATTestUtils.h.

Referenced by advance_GATList_GATint32_Iterator(), advance_GATList_String_Iterator(), create_fill_GATList_GATint32(), create_fill_GATList_String(), create_gatfile(), create_hardware_resource_description(), create_jobdescription_description(), create_software_description(), create_status(), erase_GATList_GATint32(), erase_GATList_String(), fill_GATList_GATint32(), fill_GATList_String(), GATString_Clone_Test(), GATString_CompareTo_Test(), GATString_Concatenate_Test(), GATString_Create_Test(), GATString_Create_UCS_4_INTERNAL_To_XXX_Files(), GATString_Create_XXX_Files(), GATString_Create_XXX_To_UCS_4_INTERNAL_Files(), GATString_Destroy_Test(), GATString_Destroy_Test_Harness(), GATString_EndsWith_Test(), GATString_FirstIndexOf_Test(), GATString_GetBuffer_Test(), GATString_GetEncoding_Test(), GATString_GetInterface_Test(), GATString_GetLengthInBytes_Test(), GATString_GetSubString_Test(), GATString_GetType_Test(), GATString_LastIndexOf_Test(), GATString_StartsWith_Test(), GATString_Translate_Test(), GATString_Try_Conversion(), GATString_Write_XXX(), GATString_Write_XXX_To_UCS_4_INTERNAL(), get_hardware_rd_direct(), get_hardware_rd_indirect(), get_os_software_rd_direct(), get_os_software_rd_indirect(), get_sw_description_direct(), Listener_FileCopied(), Listener_FileDeleted(), Listener_FileMoved(), Listener_FileReplicated(), LoadAdaptor(), main(), print_status(), test_entry_types(), test_GATList_GATint32(), test_GATList_GATint32_Splice(), test_GATList_GATList_GATint32(), test_GATList_String(), test_GATList_String_Splice(), test_hw_requirements(), test_positives(), test_std_file_attriutes(), test_sw_attributes(), verify_direct_serialisation(), verify_GATList_GATint32(), verify_GATList_GATint32_serialization(), verify_GATList_GATList_GATint32_serialization(), verify_GATList_String(), verify_GATList_String_serialization(), and verify_generic_serialisation().

 
#define GAT_TEST_STOP  
 

Value:

{                                                 \
    GATTest_SetIndent(GATTest_GetIndent() -1);                            \
    if ( ! GATTest_GetIndent() )                                          \
    {                                                                     \
      if ( GATTest_GetError() )                                           \
      {                                                                   \
        fprintf (stderr, GAT_POSTFIX_EEXIT, GATTest_GetError());          \
      }                                                                   \
      else                                                                \
      {                                                                   \
        fprintf (stderr, GAT_POSTFIX_SEXIT);                              \
      }                                                                   \
      fflush (stderr);                                                    \
    }                                                                     \
  }                                                                       \
                                                                          \
  }

Definition at line 94 of file GATTestUtils.h.

Referenced by advance_GATList_GATint32_Iterator(), advance_GATList_String_Iterator(), create_fill_GATList_GATint32(), create_fill_GATList_String(), create_gatfile(), create_hardware_resource_description(), create_jobdescription_description(), create_software_description(), create_status(), erase_GATList_GATint32(), erase_GATList_String(), fill_GATList_GATint32(), fill_GATList_String(), GATString_Clone_Test(), GATString_CompareTo_Test(), GATString_Concatenate_Test(), GATString_Create_Test(), GATString_Create_UCS_4_INTERNAL_To_XXX_Files(), GATString_Create_XXX_Files(), GATString_Create_XXX_To_UCS_4_INTERNAL_Files(), GATString_Destroy_Test(), GATString_Destroy_Test_Harness(), GATString_EndsWith_Test(), GATString_FirstIndexOf_Test(), GATString_GetBuffer_Test(), GATString_GetEncoding_Test(), GATString_GetInterface_Test(), GATString_GetLengthInBytes_Test(), GATString_GetSubString_Test(), GATString_GetType_Test(), GATString_LastIndexOf_Test(), GATString_StartsWith_Test(), GATString_Translate_Test(), GATString_Try_Conversion(), GATString_Write_XXX(), GATString_Write_XXX_To_UCS_4_INTERNAL(), get_hardware_rd_direct(), get_hardware_rd_indirect(), get_os_software_rd_direct(), get_os_software_rd_indirect(), get_sw_description_direct(), Listener_FileCopied(), Listener_FileDeleted(), Listener_FileMoved(), Listener_FileReplicated(), LoadAdaptor(), main(), print_status(), test_entry_types(), test_GATList_GATint32(), test_GATList_GATint32_Splice(), test_GATList_GATList_GATint32(), test_GATList_String(), test_GATList_String_Splice(), test_hw_requirements(), test_positives(), test_std_file_attriutes(), test_sw_attributes(), verify_direct_serialisation(), verify_GATList_GATint32(), verify_GATList_GATint32_serialization(), verify_GATList_GATList_GATint32_serialization(), verify_GATList_String(), verify_GATList_String_serialization(), and verify_generic_serialisation().

 
#define GAT_TEST_EXIT  
 

Value:

{                                                 \
    GATTest_SetIndent(GATTest_GetIndent() -1);                            \
    if ( ! GATTest_GetIndent() )                                          \
    {                                                                     \
      if ( GATTest_GetError() )                                           \
      {                                                                   \
        fprintf (stderr, GAT_PREFIX_NLINE, " ");                          \
        fprintf (stderr, GAT_POSTFIX_EEXIT, GATTest_GetError());          \
      }                                                                   \
      else                                                                \
      {                                                                   \
        fprintf (stderr, GAT_POSTFIX_SEXIT);                              \
      }                                                                   \
      fflush (stderr);                                                    \
    }                                                                     \
  }

Definition at line 112 of file GATTestUtils.h.

Referenced by GATString_Write_XXX(), and GATString_Write_XXX_To_UCS_4_INTERNAL().

#define GAT_TEST  
 

Value:

{                                                     \
    if ( y )                                                              \
    {                                                                     \
    }                                                                     \
    else                                                                  \
    {                                                                     \
      fprintf (stderr,   GAT_PREFIX_ERRLINE);                             \
      fprintf (stderr,   GAT_PREFIX_NLINE, " ");                          \
      fflush  (stderr);                                                   \
      GATTest_SetError (GATTest_GetError() +1);                           \
      if ( GAT_EXIT_ON_ERROR )                                            \
      {                                                                   \
        exit (-__LINE__);                                                 \
      }                                                                   \
    }                                                                     \
  }

Definition at line 129 of file GATTestUtils.h.

Referenced by advance_GATList_GATint32_Iterator(), advance_GATList_String_Iterator(), create_fill_GATList_GATint32(), create_fill_GATList_String(), create_gatfile(), create_hardware_resource_description(), create_software_description(), create_status(), erase_GATList_GATint32(), erase_GATList_String(), fill_GATList_GATint32(), fill_GATList_String(), fill_GATTable(), GATString_Clone_Test(), GATString_CompareTo_Test(), GATString_Concatenate_Test(), GATString_Create_Test(), GATString_Create_UCS_4_INTERNAL_To_XXX_Files(), GATString_Create_XXX_Files(), GATString_Create_XXX_To_UCS_4_INTERNAL_Files(), GATString_Destroy_Test(), GATString_Destroy_Test_Harness(), GATString_EndsWith_Test(), GATString_FirstIndexOf_Test(), GATString_GetBuffer_Test(), GATString_GetEncoding_Test(), GATString_GetInterface_Test(), GATString_GetLengthInBytes_Test(), GATString_GetSubString_Test(), GATString_GetType_Test(), GATString_LastIndexOf_Test(), GATString_StartsWith_Test(), GATString_Translate_Test(), GATString_Write_UCS_4_INTERNAL_To_XXX(), GATString_Write_XXX(), GATString_Write_XXX_To_UCS_4_INTERNAL(), get_hardware_rd_direct(), get_hardware_rd_indirect(), get_os_software_rd_direct(), get_os_software_rd_indirect(), get_sw_description_direct(), Listener_FileCopied(), Listener_FileDeleted(), Listener_FileMoved(), Listener_FileReplicated(), main(), on_checkpoint_issued_1(), test_entry_types(), test_GATList_GATint32(), test_GATList_GATList_GATint32(), test_GATList_String(), test_GATTable_Cloning(), test_GATTable_Serialising(), test_hw_requirements(), test_negatives_double(), test_negatives_float(), test_negatives_int(), test_negatives_object(), test_negatives_short(), test_negatives_string(), test_os_requirements(), test_positives(), test_remove_double(), test_remove_float(), test_remove_int(), test_remove_object(), test_remove_short(), test_remove_string(), test_remove_unknown(), test_std_file_attriutes(), test_sw_attributes(), verify_direct_serialisation(), verify_GATList_GATint32(), verify_GATList_GATint32_serialization(), verify_GATList_GATList_GATint32_serialization(), verify_GATList_String(), verify_GATList_String_serialization(), and verify_generic_serialisation().

#define GAT_TEST_TRACE y,
context   
 

Value:

{                                      \
    if ( y )                                                              \
    {                                                                     \
    }                                                                     \
    else                                                                  \
    {                                                                     \
      fprintf (stderr,   GAT_PREFIX_ERRLINE);                             \
      GATTest_SetError (GATTest_GetError() +1);                           \
      {                                                                   \
        GATStatus status = NULL;                                             \
        if (GAT_SUCCEEDED(GATContext_GetCurrentStatus(context, &status))) \
        {                                                                 \
          GATStatus_Trace(status);                                        \
        }                                                                 \
        else                                                              \
        {                                                                 \
          fprintf (stderr,   GAT_PREFIX_NLINE, " ");                      \
        }                                                                 \
      }                                                                   \
      fprintf (stderr,   GAT_PREFIX_NLINE, " ");                          \
      fflush  (stderr);                                                   \
      if ( GAT_EXIT_ON_ERROR )                                            \
      {                                                                   \
        exit (-__LINE__);                                                 \
      }                                                                   \
    }                                                                     \
  }

Definition at line 146 of file GATTestUtils.h.

Referenced by create_gatfile(), create_hardware_resource_description(), create_jobdescription_description(), create_software_description(), LoadAdaptor(), main(), print_status(), verify_direct_serialisation(), and verify_generic_serialisation().

#define GAT_DEBUG  
 

Value:

{                                                    \
    fprintf (stderr,     GAT_PREFIX_DEBUG, x);                            \
    fflush  (stderr);                                                     \
  }

Definition at line 174 of file GATTestUtils.h.


Function Documentation

int _GAT_TEST_INIT int    t
 

initialize test suite - internal

Definition at line 77 of file GATTestUtils.c.

References _GAT_TEST_FREE_ALLOCATED_MEMORY(), and allocated_memory.

void _GAT_TEST_FINISH const char *    rcs
 

finish test suite - internal

Definition at line 94 of file GATTestUtils.c.

References _GAT_TEST_FREE_ALLOCATED_MEMORY(), and GATTest_GetError().

const char* GATTest_GetTempDirName void   
 

get name for temp directory checks for ENV{TEMP}, and creates dir if needed

Definition at line 130 of file GATTestUtils.c.

References strdup, and TEMP.

Referenced by GATString_Create_UCS_4_INTERNAL_To_XXX_Files(), GATString_Create_XXX_To_UCS_4_INTERNAL_Files(), and GATTest_GetTempFileName().

const char* GATTest_GetTempFileName const char *    name
 

get name for temp file in temp dir

Definition at line 195 of file GATTestUtils.c.

References allocated_memory, DELIM, GATTest_GetTempDirName(), and name.

Referenced by GATTest_CreateTempFile(), GATTest_GetTempFileNameF(), and main().

const char* GATTest_CreateTempFile const char *    name
 

creates the temp file given, and filles with some dummy data

Definition at line 300 of file GATTestUtils.c.

References GATTest_GetTempFileName(), and name.

Referenced by main().

const char* GATTest_GetTempFileNameF const char *    format,
...   
 

same as abve, but allows printf like spec of file name - useful for file enumeration etc.

Definition at line 237 of file GATTestUtils.c.

References allocated_memory, GATTest_GetTempFileName(), and size.

Referenced by GATString_Clone_Test(), GATString_CompareTo_Test(), GATString_Create_Test(), GATString_Create_UCS_4_INTERNAL_To_XXX_Files(), GATString_Create_XXX_Files(), GATString_Create_XXX_To_UCS_4_INTERNAL_Files(), GATString_Destroy_Test(), GATString_Destroy_Test_Harness(), GATString_EndsWith_Test(), GATString_GetBuffer_Test(), GATString_GetEncoding_Test(), GATString_GetLengthInBytes_Test(), GATString_StartsWith_Test(), and GATString_Translate_Test().

int GATTest_GetIndent void   
 

get number of spaces for print indenting

Definition at line 105 of file GATTestUtils.c.

References _indent.

void GATTest_SetIndent int    indent
 

set number of spaces for print indenting

Definition at line 111 of file GATTestUtils.c.

References _indent.

int GATTest_GetError void   
 

get current error value

Definition at line 117 of file GATTestUtils.c.

References _error.

Referenced by _GAT_TEST_FINISH().

void GATTest_SetError int    error
 

set current error value

Definition at line 123 of file GATTestUtils.c.

References _error.