tests/tst-merge4.c
/* Test case:
 * Try to open two files, where one has group entries, the other not
 * Call econf_mergeFiles with this.
 * Application should not crash and return correct key values
*/
Test case:
Try to open two files, where one has group entries, the other not
Call econf_mergeFiles with this.
Application should not crash and return correct key values
Test case : Try to open two files where one has group entries the other not Call econf_mergeFiles with this . Application should not crash and return correct key values
static bool
check_string (econf_file *key_file, const char *group, const char *key,
	      const char *value)
{
  econf_err error;
  char *val_String;
  if ((error = econf_getStringValue(key_file, group, key, &val_String)))
    {
      fprintf (stderr, "ERROR: reading (%s,%s): %s\n", group, key, econf_errString(error));
      return false;
    }
  printf ("reading (%s,%s): got '%s', expected '%s'\n", group, key, value, val_String);
  if (strcmp(val_String, value?value:"") != 0)
    {
      fprintf (stderr, "ERROR: reading (%s,%s): expected '%s', got: '%s'\n",
	       group, key, value, val_String);
      return false;
    }
  free(val_String);
  return true;
}
static bool check_string ( econf_file * key_file , const char * group , const char * key , const char * value ) { econf_err error ; char * val_String ; if ( ( error = econf_getStringValue ( key_file , group , key , & val_String ) ) ) { fprintf ( stderr , " \n " , group , key , econf_errString ( error ) ) ; return false ; } printf ( " \n " , group , key , value , val_String ) ; if ( strcmp ( val_String , value ? value : " " ) != 0 ) { fprintf ( stderr , " \n " , group , key , value , val_String ) ; return false ; } free ( val_String ) ; return true ; }
Test case:
 Try to open two files, where one has group entries, the other not
 Call econf_mergeFiles with this.
Test case : Try to open two files where one has group entries the other not Call econf_mergeFiles with this .
/* NULL means empty string */