1 #include <lal/LALConfig.h>
6 #include <lal/LALStdlib.h>
7 #include <lal/LALValue.h>
8 #include <lal/LALDict.h>
11 #define UNUSED __attribute__ ((unused))
16 #define CHAR_VALUE LAL_INT8_C(+111)
17 #define INT2_VALUE LAL_INT8_C(-11111)
18 #define INT4_VALUE LAL_INT8_C(-1111111111)
19 #define INT8_VALUE LAL_INT8_C(-111111111111111111)
20 #define UCHAR_VALUE LAL_UINT8_C(222)
21 #define UINT2_VALUE LAL_UINT8_C(44444)
22 #define UINT4_VALUE LAL_UINT8_C(3333333333)
23 #define UINT8_VALUE LAL_UINT8_C(11111111111111111111)
24 #define REAL4_VALUE 100.0
25 #define REAL8_VALUE 1e100
26 #define COMPLEX8_VALUE 3.0 + 4.0 * I
27 #define COMPLEX16_VALUE 3e100 + 4e100 * I
52 return err ? NULL : dict;
79 return err ? NULL : list;
101 static int string_value_cmp(
const LALValue *value1,
const LALValue *value2,
void UNUSED *thunk)
106 #define COMPARE(v, TYPE) (v == TYPE ## _VALUE)
109 fprintf(stderr, "Testing %s...", #TYPE); \
110 entry = XLALDictLookup(dict, #TYPE); \
111 orig = XLALDictEntryGetValue(entry); \
112 size = XLALValueGetSize(orig); \
113 copy = XLALValueRealloc(copy, size); \
114 copy = XLALValueCopy(copy, orig); \
115 if (!XLALValueEqual(copy, orig)) \
117 if (!COMPARE(XLALValueGet ## TYPE(copy), TYPE)) \
119 XLALDictRemove(dict, #TYPE); \
120 fprintf(stderr, " passed\n");
129 const LALValue *orig;
130 LALValue *copy = NULL;
157 #define COMPARE(v, TYPE) (!memcmp(blob = v, BLOB_VALUE, sizeof(BLOB_VALUE)))
162 #define COMPARE(v, TYPE) (!strcmp(v, String_VALUE))
LALList * XLALDictKeys(const LALDict *dict)
void XLALDestroyDict(LALDict *dict)
int XLALDictInsertBLOBValue(LALDict *dict, const char *key, const void *blob, size_t size)
size_t XLALDictSize(const LALDict *dict)
int XLALDictInsertStringValue(LALDict *dict, const char *key, const char *string)
LALDict * XLALCreateDict(void)
int XLALDictInsertUINT4Value(LALDict *dict, const char *key, UINT4 value)
int XLALDictInsertUINT2Value(LALDict *dict, const char *key, UINT2 value)
int XLALDictInsertINT2Value(LALDict *dict, const char *key, INT2 value)
int XLALDictInsertINT8Value(LALDict *dict, const char *key, INT8 value)
int XLALDictInsertCOMPLEX16Value(LALDict *dict, const char *key, COMPLEX16 value)
int XLALDictInsertINT4Value(LALDict *dict, const char *key, INT4 value)
int XLALDictInsertREAL8Value(LALDict *dict, const char *key, REAL8 value)
int XLALDictInsertCOMPLEX8Value(LALDict *dict, const char *key, COMPLEX8 value)
int XLALDictInsertUINT8Value(LALDict *dict, const char *key, UINT8 value)
int XLALDictInsertUCHARValue(LALDict *dict, const char *key, UCHAR value)
int XLALDictInsertREAL4Value(LALDict *dict, const char *key, REAL4 value)
int XLALDictInsertCHARValue(LALDict *dict, const char *key, CHAR value)
int XLALListReverse(LALList *list)
size_t XLALListSize(const LALList *list)
void XLALListIterInit(LALListIter *iter, LALList *list)
int XLALListSort(LALList *list, int(*cmp)(const LALValue *, const LALValue *, void *), void *thunk)
int XLALListAddStringValue(LALList *list, const char *string)
const LALValue * XLALListItemGetValue(const LALListItem *item)
void XLALDestroyList(LALList *list)
LALListItem * XLALListIterNext(LALListIter *iter)
LALList * XLALCreateList(void)
void LALCheckMemoryLeaks(void)
int XLALValueEqual(const LALValue *value1, const LALValue *value2)
void XLALDestroyValue(LALValue *value)
const char * XLALValueGetString(const LALValue *value)
static int lists_are_equal(LALList *list1, LALList *list2)
static LALList * create_list(void)
static int string_value_cmp(const LALValue *value1, const LALValue *value2, void UNUSED *thunk)
static LALDict * create_dict(void)
unsigned char UCHAR
One-byte unsigned integer, see Headers LAL(Atomic)Datatypes.h for more details.
uint64_t UINT8
Eight-byte unsigned integer; on some platforms this is equivalent to unsigned long int instead.
double complex COMPLEX16
Double-precision floating-point complex number (16 bytes total)
double REAL8
Double precision real floating-point number (8 bytes).
int16_t INT2
Two-byte signed integer.
int64_t INT8
Eight-byte signed integer; on some platforms this is equivalent to long int instead.
uint16_t UINT2
Two-byte unsigned integer.
char CHAR
One-byte signed integer, see Headers LAL(Atomic)Datatypes.h for more details.
uint32_t UINT4
Four-byte unsigned integer.
float complex COMPLEX8
Single-precision floating-point complex number (8 bytes total)
int32_t INT4
Four-byte signed integer.
float REAL4
Single precision real floating-point number (4 bytes).