automerge/rust/automerge-c/test/main.c
Jason Kankiewicz 8de2fa9bd4
C API 2 (#530)
The AMvalue union, AMlistItem struct, AMmapItem struct, and AMobjItem struct are gone, replaced by the AMitem struct.

The AMchangeHashes, AMchanges, AMlistItems, AMmapItems, AMobjItems, AMstrs, and AMsyncHaves iterators are gone, replaced by the AMitems iterator.

The AMitem struct is opaque, getting and setting values is now achieved exclusively through function calls.

The AMitemsNext(), AMitemsPrev(), and AMresultItem() functions return a pointer to an AMitem struct so you ultimately get the same thing whether you're iterating over a sequence or calling AMmapGet() or AMlistGet().

Calling AMitemResult() on an AMitem struct will produce a new AMresult struct referencing its storage so now the AMresult struct for an iterator can be subsequently freed without affecting the AMitem structs that were filtered out of it.

The storage for a set of AMitem structs can be recombined into a single AMresult struct by passing pointers to their corresponding AMresult structs to AMresultCat().

For C/C++ programmers, I've added AMstrCmp(), AMstrdup(), AM{idxType,objType,status,valType}ToString() and AM{idxType,objType,status,valType}FromString(). It's also now possible to pass arbitrary parameters through AMstack{Item,Items,Result}() to a callback function.
2023-02-25 18:47:00 +00:00

28 lines
629 B
C

#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
/* third-party */
#include <cmocka.h>
extern int run_actor_id_tests(void);
extern int run_byte_span_tests(void);
extern int run_doc_tests(void);
extern int run_enum_string_tests(void);
extern int run_item_tests(void);
extern int run_list_tests(void);
extern int run_map_tests(void);
extern int run_ported_wasm_suite(void);
int main(void) {
return (run_actor_id_tests() + run_byte_span_tests() + run_doc_tests() + run_enum_string_tests() +
run_item_tests() + run_list_tests() + run_map_tests() + run_ported_wasm_suite());
}