LAL  7.5.0.1-89842e6
ValueTest.c File Reference

Prototypes

static LALDict * create_dict (void)
 
static LALList * create_list (void)
 
static int lists_are_equal (LALList *list1, LALList *list2)
 
static int string_value_cmp (const LALValue *value1, const LALValue *value2, void UNUSED *thunk)
 
int main (void)
 

Go to the source code of this file.

Macros

#define CHAR_VALUE   LAL_INT8_C(+111)
 
#define INT2_VALUE   LAL_INT8_C(-11111)
 
#define INT4_VALUE   LAL_INT8_C(-1111111111)
 
#define INT8_VALUE   LAL_INT8_C(-111111111111111111)
 
#define UCHAR_VALUE   LAL_UINT8_C(222)
 
#define UINT2_VALUE   LAL_UINT8_C(44444)
 
#define UINT4_VALUE   LAL_UINT8_C(3333333333)
 
#define UINT8_VALUE   LAL_UINT8_C(11111111111111111111)
 
#define REAL4_VALUE   100.0
 
#define REAL8_VALUE   1e100
 
#define COMPLEX8_VALUE   3.0 + 4.0 * I
 
#define COMPLEX16_VALUE   3e100 + 4e100 * I
 
#define COMPARE(v, TYPE)   (v == TYPE ## _VALUE)
 
#define TEST(TYPE)
 
#define COMPARE(v, TYPE)   (!memcmp(blob = v, BLOB_VALUE, sizeof(BLOB_VALUE)))
 
#define COMPARE(v, TYPE)   (!strcmp(v, String_VALUE))
 

Variables

char BLOB_VALUE [5] = "\x68\x65\x6c\x6c\x6f"
 
char String_VALUE [] = "world"
 

Macro Definition Documentation

◆ CHAR_VALUE

#define CHAR_VALUE   LAL_INT8_C(+111)

Definition at line 16 of file ValueTest.c.

◆ INT2_VALUE

#define INT2_VALUE   LAL_INT8_C(-11111)

Definition at line 17 of file ValueTest.c.

◆ INT4_VALUE

#define INT4_VALUE   LAL_INT8_C(-1111111111)

Definition at line 18 of file ValueTest.c.

◆ INT8_VALUE

#define INT8_VALUE   LAL_INT8_C(-111111111111111111)

Definition at line 19 of file ValueTest.c.

◆ UCHAR_VALUE

#define UCHAR_VALUE   LAL_UINT8_C(222)

Definition at line 20 of file ValueTest.c.

◆ UINT2_VALUE

#define UINT2_VALUE   LAL_UINT8_C(44444)

Definition at line 21 of file ValueTest.c.

◆ UINT4_VALUE

#define UINT4_VALUE   LAL_UINT8_C(3333333333)

Definition at line 22 of file ValueTest.c.

◆ UINT8_VALUE

#define UINT8_VALUE   LAL_UINT8_C(11111111111111111111)

Definition at line 23 of file ValueTest.c.

◆ REAL4_VALUE

#define REAL4_VALUE   100.0

Definition at line 24 of file ValueTest.c.

◆ REAL8_VALUE

#define REAL8_VALUE   1e100

Definition at line 25 of file ValueTest.c.

◆ COMPLEX8_VALUE

#define COMPLEX8_VALUE   3.0 + 4.0 * I

Definition at line 26 of file ValueTest.c.

◆ COMPLEX16_VALUE

#define COMPLEX16_VALUE   3e100 + 4e100 * I

Definition at line 27 of file ValueTest.c.

◆ COMPARE [1/3]

#define COMPARE (   v,
  TYPE 
)    (v == TYPE ## _VALUE)

Definition at line 106 of file ValueTest.c.

◆ TEST

#define TEST (   TYPE)
Value:
fprintf(stderr, "Testing %s...", #TYPE); \
entry = XLALDictLookup(dict, #TYPE); \
orig = XLALDictEntryGetValue(entry); \
size = XLALValueGetSize(orig); \
copy = XLALValueRealloc(copy, size); \
copy = XLALValueCopy(copy, orig); \
if (!XLALValueEqual(copy, orig)) \
return 1; \
if (!COMPARE(XLALValueGet ## TYPE(copy), TYPE)) \
return 1; \
XLALDictRemove(dict, #TYPE); \
fprintf(stderr, " passed\n");
#define TYPE
LALDictEntry * XLALDictLookup(LALDict *dict, const char *key)
Definition: LALDict.c:282
const LALValue * XLALDictEntryGetValue(const LALDictEntry *entry)
Definition: LALDict.c:120
LALValue * XLALValueRealloc(LALValue *value, size_t size)
Definition: LALValue.c:40
int XLALValueEqual(const LALValue *value1, const LALValue *value2)
Definition: LALValue.c:203
LALValue * XLALValueCopy(LALValue *copy, const LALValue *orig)
Definition: LALValue.c:60
size_t XLALValueGetSize(const LALValue *value)
Definition: LALValue.c:185
#define fprintf
#define COMPARE(v, TYPE)
Definition: ValueTest.c:106

Definition at line 108 of file ValueTest.c.

◆ COMPARE [2/3]

#define COMPARE (   v,
  TYPE 
)    (!memcmp(blob = v, BLOB_VALUE, sizeof(BLOB_VALUE)))

Definition at line 106 of file ValueTest.c.

◆ COMPARE [3/3]

#define COMPARE (   v,
  TYPE 
)    (!strcmp(v, String_VALUE))

Definition at line 106 of file ValueTest.c.

Function Documentation

◆ create_dict()

static LALDict* create_dict ( void  )
static

Definition at line 31 of file ValueTest.c.

◆ create_list()

static LALList* create_list ( void  )
static

Definition at line 55 of file ValueTest.c.

◆ lists_are_equal()

static int lists_are_equal ( LALList *  list1,
LALList *  list2 
)
static

Definition at line 82 of file ValueTest.c.

◆ string_value_cmp()

static int string_value_cmp ( const LALValue *  value1,
const LALValue *  value2,
void UNUSED *  thunk 
)
static

Definition at line 101 of file ValueTest.c.

◆ main()

int main ( void  )

Definition at line 122 of file ValueTest.c.

Variable Documentation

◆ BLOB_VALUE

char BLOB_VALUE[5] = "\x68\x65\x6c\x6c\x6f"

Definition at line 28 of file ValueTest.c.

◆ String_VALUE

char String_VALUE[] = "world"

Definition at line 29 of file ValueTest.c.