29#define VALUE_TESTS(X) \
30 X("values::basics", test_value_basics), \
31 X("values::f64_zero_eq_hash", test_value_f64_zero_eq_hash), \
32 X("values::list_cons_type_check", test_value_list_cons_type_check), \
33 X("values::map_unhashable_key", test_value_map_unhashable_key),
36# define V_TEST_LOG(...) DBG("VALUE_TEST", __VA_ARGS__)
38# define V_TEST_LOG(...)
#define TEST_ASSERT(cond)
#define RELEASE_CONTEXT(x)
#define SHUTDOWN_ENGINE(mm, engine)
#define MAKE_ENGINE(mm, engine)
#define MAKE_CONTEXT(engine, x)
srn_metadata_t absurd_metadata
We use this for testing. Defined once in core.c.
@ VError
VError should be last.
srn_value_t * srn_list_cons(srn_context_t *ctx, srn_metadata_t *metadata, srn_value_t *value, srn_value_t *list)
Prepend value to list, returning a new list.
srn_value_t * srn_list_make(srn_context_t *ctx, srn_metadata_t *metadata, srn_value_t *const *items, size_t count)
Build a list from an array of elements.
srn_value_t * srn_map_assoc(srn_context_t *ctx, srn_metadata_t *metadata, srn_value_t *map, srn_value_t *key, srn_value_t *value)
srn_value_t * srn_map_empty(srn_context_t *ctx, srn_metadata_t *metadata)
static srn_value_t * srn_make_i64(srn_context_t *ctx, srn_metadata_t *metadata, int64_t x)
srn_hash_t srn_value_hash(const srn_context_t *ctx, const srn_value_t *v)
Compute the xxHash32 of a value using the engine seed.
srn_value_t * srn_value_eq(const srn_context_t *ctx, const srn_value_t *a, const srn_value_t *b)
Check to values for equality. Return a boolean.
int64_t i64
We represent all the immidiate numbers with this field and cast as we to an appropriate type.
union srn_value_t::@033047061046230251001111174367071167226300135003 as
IMPORTANT NOTE: The size of this union should never be larger than a word.
static void test_value_f64_zero_eq_hash()
IEEE equality makes +0.0 and -0.0 equal, so the documented eq => hash invariant requires them to hash...
static void test_value_map_unhashable_key()
A key the hash protocol cannot hash must come back as an error value from assoc, not abort the proces...
static void test_value_list_cons_type_check()
Consing onto a value that is neither nil nor a list must produce an error value, not reinterpret the ...
static void test_value_basics()