Logo Search packages:      
Sourcecode: latrace version File versions  Download package

test-lib.h

#ifndef TEST_LIB
#define TEST_LIB

#include <config.h>
#include <stdlib.h>

struct lt_config_shared *config_init(void);
void config_clear(struct lt_config_shared *sh);
int fout_read(struct lt_config_shared *sh, char *buf, int size);

enum {
      RE_TEST_TYPE_STR = 1,
      RE_TEST_TYPE_INT = 2,
      RE_TEST_TYPE_PID = 3,
};

enum {
      RE_TEST_OFF_UNDEF = -1,
};

enum {
      RE_TEST_OK = -1,
};

00025 struct re_test_data {
      int type;
      int so;
      int eo;
      char *pat;
};

int re_test(char *line, struct re_test_data *data, int cnt);

#define TEST_START() sh->disabled = 0
#define TEST_STOP()  sh->disabled = 1

#define PASSED() \
do { \
      printf("."); \
      fflush(NULL); \
} while(0)

#define FAILED(fmt, args...) \
do { \
      char lpbuf[1024]; \
      sprintf(lpbuf, "%s:%d failed - %s", \
            __FUNCTION__, \
            __LINE__, \
            fmt); \
      printf(lpbuf, ## args); \
      fflush(NULL); \
      exit(-1); \
} while(0)

#define TEST(testfn) \
do { \
      if (testfn(sh)) { \
            printf("FAILED %s\n", #testfn); \
            return -1; \
      } \
} while(0)

#define BUFSIZE 1000

#endif

Generated by  Doxygen 1.6.0   Back to index