SimGrid  3.13
Versatile Simulation of Distributed Systems
xbt_str_unit.c File Reference
#include <stdio.h>
#include "xbt.h"
#include "xbt/str.h"

Macros

#define mytest(name, input, expected)
 
#define mytest_str(name, input, separator, expected)
 
#define test_parse_error(function, name, variable, str)
 
#define test_parse_ok(function, name, variable, str, value)
 

Functions

 XBT_TEST_UNIT ("xbt_str_split_quoted", test_split_quoted,"test the function xbt_str_split_quoted")
 
 XBT_TEST_UNIT ("xbt_str_split_str", test_split_str,"test the function xbt_str_split_str")
 
 XBT_TEST_UNIT ("xbt_str_parse", test_parse,"Test the parsing functions")
 

Macro Definition Documentation

#define mytest (   name,
  input,
  expected 
)
Value:
s=xbt_str_join(d,"XXX"); \
xbt_test_assert(!strcmp(s,expected),\
"Input (%s) leads to (%s) instead of (%s)", \
input,s,expected);\
free(s); \
void int MPI_Datatype int MPI_Aint int MPI_Datatype MPI_Op MPI_Win win void int MPI_Datatype void int MPI_Datatype MPI_Comm comm MPI_Aint MPI_Info void baseptr void int MPI_Datatype void int MPI_Datatype MPI_Comm comm MPI_Comm int keyval MPI_Comm int void attr_value void int MPI_Datatype int MPI_Comm comm MPI_Comm int int int int MPI_Comm comm_cart MPI_Comm int int int int coords MPI_Comm int int int int dest MPI_Comm MPI_Comm int result MPI_Comm MPI_Group MPI_Comm newcomm MPI_Comm comm int keyval MPI_Comm int void int flag MPI_Comm MPI_Group group MPI_Comm int void attribute_val MPI_Comm int int MPI_Comm comm_out int int errorclass int flag void baseptr void int MPI_Datatype void int int MPI_Datatype int MPI_Comm comm MPI_Status MPI_Datatype int count char * name
Definition: smpi_mpi.cpp:83
xbt_dynar_t xbt_str_split_quoted(const char *s)
Splits a string into a dynar of strings, taking quotes into account.
Definition: xbt_str.c:375
char * xbt_str_join(xbt_dynar_t dynar, const char *sep)
Join a set of strings as a single string.
Definition: xbt_str.c:399
#define xbt_test_add(...)
Declare that a new test begins (printf-like parameters, describing the test)
Definition: cunit.h:107
#define xbt_test_assert(...)
The lastly started test is actually an assert.
Definition: cunit.h:118
void xbt_dynar_free(xbt_dynar_t *dynar)
Destructor.
Definition: dynar.c:180
#define mytest_str (   name,
  input,
  separator,
  expected 
)
Value:
d=xbt_str_split_str(input, separator); \
s=xbt_str_join(d,"XXX"); \
xbt_test_assert(!strcmp(s,expected),\
"Input (%s) leads to (%s) instead of (%s)", \
input,s,expected);\
free(s); \
void int MPI_Datatype int MPI_Aint int MPI_Datatype MPI_Op MPI_Win win void int MPI_Datatype void int MPI_Datatype MPI_Comm comm MPI_Aint MPI_Info void baseptr void int MPI_Datatype void int MPI_Datatype MPI_Comm comm MPI_Comm int keyval MPI_Comm int void attr_value void int MPI_Datatype int MPI_Comm comm MPI_Comm int int int int MPI_Comm comm_cart MPI_Comm int int int int coords MPI_Comm int int int int dest MPI_Comm MPI_Comm int result MPI_Comm MPI_Group MPI_Comm newcomm MPI_Comm comm int keyval MPI_Comm int void int flag MPI_Comm MPI_Group group MPI_Comm int void attribute_val MPI_Comm int int MPI_Comm comm_out int int errorclass int flag void baseptr void int MPI_Datatype void int int MPI_Datatype int MPI_Comm comm MPI_Status MPI_Datatype int count char * name
Definition: smpi_mpi.cpp:83
char * xbt_str_join(xbt_dynar_t dynar, const char *sep)
Join a set of strings as a single string.
Definition: xbt_str.c:399
#define xbt_test_add(...)
Declare that a new test begins (printf-like parameters, describing the test)
Definition: cunit.h:107
#define xbt_test_assert(...)
The lastly started test is actually an assert.
Definition: cunit.h:118
void xbt_dynar_free(xbt_dynar_t *dynar)
Destructor.
Definition: dynar.c:180
xbt_dynar_t xbt_str_split_str(const char *s, const char *sep)
This functions splits a string after using another string as separator For example A!!B!!C splitted a...
Definition: xbt_str.c:231
#define test_parse_error (   function,
  name,
  variable,
  str 
)
Value:
do { \
TRY { \
variable = function(str, "Parse error"); \
xbt_test_fail("The test '%s' did not detect the problem",name ); \
} CATCH(e) { \
} else { \
} \
} \
} while (0)
xbt_errcat_t category
category like HTTP (what went wrong)
Definition: ex.h:272
void int MPI_Datatype int MPI_Aint int MPI_Datatype MPI_Op MPI_Win win void int MPI_Datatype void int MPI_Datatype MPI_Comm comm MPI_Aint MPI_Info void baseptr void int MPI_Datatype void int MPI_Datatype MPI_Comm comm MPI_Comm int keyval MPI_Comm int void attr_value void int MPI_Datatype int MPI_Comm comm MPI_Comm int int int int MPI_Comm comm_cart MPI_Comm int int int int coords MPI_Comm int int int int dest MPI_Comm MPI_Comm int result MPI_Comm MPI_Group MPI_Comm newcomm MPI_Comm comm int keyval MPI_Comm int void int flag MPI_Comm MPI_Group group MPI_Comm int void attribute_val MPI_Comm int int MPI_Comm comm_out int int errorclass int flag void baseptr void int MPI_Datatype void int int MPI_Datatype int MPI_Comm comm MPI_Status MPI_Datatype int count char * name
Definition: smpi_mpi.cpp:83
void xbt_ex_free(xbt_ex_t e)
Exception destructor.
Definition: ex.c:192
#define TRY
Introduce a block where exception may be dealed with.
Definition: ex.h:332
Invalid argument.
Definition: ex.h:252
#define CATCH(e)
the block for catching (ie, deal with) an exception
Definition: ex.h:369
if(!(yy_init))
Definition: dax_dtd.c:1795
#define xbt_test_fail(...)
Declare that the lastly started test failed (printf-like parameters, describing failure cause) ...
Definition: cunit.h:110
#define xbt_test_add(...)
Declare that a new test begins (printf-like parameters, describing the test)
Definition: cunit.h:107
xbt_ex_t e
Definition: dict_unit.c:156
void xbt_test_exception(xbt_ex_t e)
Declare that the lastly started test failed because of the provided exception.
Definition: cunit.c:670
#define test_parse_ok (   function,
  name,
  variable,
  str,
  value 
)
Value:
do { \
TRY { \
variable = function(str, "Parse error"); \
} CATCH(e) { \
} \
xbt_test_assert(variable == value, "Fail to parse '%s'", str); \
} while (0)
void int MPI_Datatype int MPI_Aint int MPI_Datatype MPI_Op MPI_Win win void int MPI_Datatype void int MPI_Datatype MPI_Comm comm MPI_Aint MPI_Info void baseptr void int MPI_Datatype void int MPI_Datatype MPI_Comm comm MPI_Comm int keyval MPI_Comm int void attr_value void int MPI_Datatype int MPI_Comm comm MPI_Comm int int int int MPI_Comm comm_cart MPI_Comm int int int int coords MPI_Comm int int int int dest MPI_Comm MPI_Comm int result MPI_Comm MPI_Group MPI_Comm newcomm MPI_Comm comm int keyval MPI_Comm int void int flag MPI_Comm MPI_Group group MPI_Comm int void attribute_val MPI_Comm int int MPI_Comm comm_out int int errorclass int flag void baseptr void int MPI_Datatype void int int MPI_Datatype int MPI_Comm comm MPI_Status MPI_Datatype int count char * name
Definition: smpi_mpi.cpp:83
#define TRY
Introduce a block where exception may be dealed with.
Definition: ex.h:332
#define CATCH(e)
the block for catching (ie, deal with) an exception
Definition: ex.h:369
#define xbt_test_add(...)
Declare that a new test begins (printf-like parameters, describing the test)
Definition: cunit.h:107
#define xbt_test_assert(...)
The lastly started test is actually an assert.
Definition: cunit.h:118
xbt_ex_t e
Definition: dict_unit.c:156
void xbt_test_exception(xbt_ex_t e)
Declare that the lastly started test failed because of the provided exception.
Definition: cunit.c:670

Function Documentation

XBT_TEST_UNIT ( "xbt_str_split_quoted"  ,
test_split_quoted  ,
"test the function xbt_str_split_quoted  
)
XBT_TEST_UNIT ( "xbt_str_split_str"  ,
test_split_str  ,
"test the function xbt_str_split_str  
)
XBT_TEST_UNIT ( "xbt_str_parse"  ,
test_parse  ,
"Test the parsing functions"   
)