test_json()

test_json()#

test_json() compares a given JSON object with an expected JSON object and verifies if they match. It also checks for expected and unexpected log messages.

Prototype

int test_json(
    json_t *jn_found   // owned
);

Parameters

Key

Type

Description

jn_found

json_t *

The JSON object to be tested. It is owned and will be decremented after use.


Return Value

Returns 0 if the JSON object matches the expected JSON and all expected log messages are consumed. Returns -1 if there is a mismatch or unexpected log messages are found.

Notes

If both jn_found and the expected JSON are NULL, only the log messages are checked. Uses match_record() to compare JSON objects. Calls check_log_result() to validate log messages.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples