diff --git a/common/test/run-json.c b/common/test/run-json.c new file mode 100644 index 000000000..e599a0f59 --- /dev/null +++ b/common/test/run-json.c @@ -0,0 +1,45 @@ +#include "../json.c" +#include + +/* AUTOGENERATED MOCKS START */ +/* AUTOGENERATED MOCKS END */ + +int main(void) +{ + struct json_result *result = new_json_result(NULL); + jsmntok_t *toks; + const jsmntok_t *x; + bool valid; + int i; + char *badstr = tal_arr(result, char, 256); + const char *str; + + /* Fill with junk, and nul-terminate (256 -> 0) */ + for (i = 1; i < 257; i++) + badstr[i-1] = i; + + json_object_start(result, NULL); + json_add_string(result, "x", badstr); + json_object_end(result); + + /* Parse back in, make sure nothing crazy. */ + str = json_result_string(result); + + toks = json_parse_input(str, strlen(str), &valid); + assert(valid); + assert(toks); + + assert(toks[0].type == JSMN_OBJECT); + x = json_get_member(str, toks, "x"); + assert(x); + assert(x->type == JSMN_STRING); + assert((x->end - x->start) == 255); + for (i = x->start; i < x->end; i++) { + assert(cisprint(str[i])); + assert(str[i] != '\\'); + assert(str[i] != '"'); + assert(str[i] == '?' || str[i] == badstr[i - x->start]); + } + tal_free(result); + return 0; +} diff --git a/lightningd/test/run-cryptomsg.c b/lightningd/test/run-cryptomsg.c index 35126ede9..fead63c04 100644 --- a/lightningd/test/run-cryptomsg.c +++ b/lightningd/test/run-cryptomsg.c @@ -47,6 +47,8 @@ void dev_blackhole_fd(int fd UNNEEDED) /* Generated stub for dev_sabotage_fd */ void dev_sabotage_fd(int fd UNNEEDED) { fprintf(stderr, "dev_sabotage_fd called!\n"); abort(); } +/* Could not find declaration for secp256k1_ecdsa_recoverable_signature_parse_compact */ +/* Could not find declaration for secp256k1_ecdsa_recoverable_signature_serialize_compact */ /* AUTOGENERATED MOCKS END */ enum dev_disconnect dev_disconnect(int pkt_type) diff --git a/lightningd/test/run-find_my_path.c b/lightningd/test/run-find_my_path.c index 64c6ebc1c..13b673618 100644 --- a/lightningd/test/run-find_my_path.c +++ b/lightningd/test/run-find_my_path.c @@ -46,6 +46,8 @@ void populate_peer(struct lightningd *ld UNNEEDED, struct peer *peer UNNEEDED) /* Generated stub for register_opts */ void register_opts(struct lightningd *ld UNNEEDED) { fprintf(stderr, "register_opts called!\n"); abort(); } +/* Could not find declaration for secp256k1_ecdsa_recoverable_signature_parse_compact */ +/* Could not find declaration for secp256k1_ecdsa_recoverable_signature_serialize_compact */ /* Generated stub for setup_color_and_alias */ void setup_color_and_alias(struct lightningd *ld UNNEEDED) { fprintf(stderr, "setup_color_and_alias called!\n"); abort(); }