[asterisk-commits] dlee: branch dlee/jansson r378913 - in /team/dlee/jansson: include/asterisk/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 11 14:13:45 CST 2013


Author: dlee
Date: Fri Jan 11 14:13:36 2013
New Revision: 378913

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=378913
Log:
Massive cleanup of test_json

Modified:
    team/dlee/jansson/include/asterisk/json.h
    team/dlee/jansson/include/asterisk/test.h
    team/dlee/jansson/main/test.c
    team/dlee/jansson/res/res_json.c
    team/dlee/jansson/tests/test_json.c

Modified: team/dlee/jansson/include/asterisk/json.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/include/asterisk/json.h?view=diff&rev=378913&r1=378912&r2=378913
==============================================================================
--- team/dlee/jansson/include/asterisk/json.h (original)
+++ team/dlee/jansson/include/asterisk/json.h Fri Jan 11 14:13:36 2013
@@ -42,6 +42,16 @@
  * affects all users of the JSON library, shouldn't normally be used.
  */
 void ast_json_set_alloc_funcs(void *(*malloc_fn)(size_t), void (*free_fn)(void*));
+
+/*!
+ * \brief Change alloc funcs back to the resource module defaults.
+ *
+ * \since 12.0.0
+ *
+ * If you use \ref ast_json_set_alloc_funcs to temporarily change the allocator functions
+ * (i.e., from in a unit test), this function sets them back the way they should be.
+ */
+void ast_json_reset_alloc_funcs(void);
 
 /*!
  * \struct ast_json

Modified: team/dlee/jansson/include/asterisk/test.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/include/asterisk/test.h?view=diff&rev=378913&r1=378912&r2=378913
==============================================================================
--- team/dlee/jansson/include/asterisk/test.h (original)
+++ team/dlee/jansson/include/asterisk/test.h Fri Jan 11 14:13:36 2013
@@ -284,25 +284,30 @@
 #define ast_test_status_update(t, f, ...) __ast_test_status_update(__FILE__, __PRETTY_FUNCTION__, __LINE__, (t), (f), ## __VA_ARGS__)
 
 /*!
- * \ref ast_test_check
+ * \brief Check a test condition, failing the test if it's not true.
  *
  * \since 12.0.0
- */
-enum ast_test_result_state __ast_test_check(const char *file, const char *function, int line, struct ast_test *test, const char *condition_str, enum ast_test_result_state current_res, int condition);
-
-/*!
- * \brief Accumulate test results for a test.
- *
- * \since 12.0.0
- *
- * This macro evaluates \a condition, then updates \a res and the test status accordingly. If the condition evaluates to
- * true (non-zero), nothing happens. If it evaluates to false (zero), then res is set to \a AST_TEST_FAIL and the failure
- * is printed using \ref ast_test_status_update.
- *
- * \param \a res Local variable of type \a ast_test_result_state.
+ *
+ * This macro evaluates \a condition. If the condition evaluates to true (non-zero),
+ * nothing happens. If it evaluates to false (zero), then the failure is printed
+ * using \ref ast_test_status_update, and the current test is ended with AST_TEST_FAIL.
+ *
+ * Sadly, the name 'ast_test_assert' was already taken.
+ *
+ * Note that since this macro returns from the current test, there must not be any
+ * cleanup work to be done before returning. Use \ref RAII_VAR for test cleanup.
+ *
+ * \param \a test Currently executing test
  * \param \a condition Boolean condition to check.
  */
-#define ast_test_check(res, condition) res = __ast_test_check( __FILE__, __PRETTY_FUNCTION__, __LINE__, test, #condition, (res), (condition))
+#define ast_test_validate(test, condition)				\
+	do {								\
+		if (!(condition)) {					\
+			__ast_test_status_update(__FILE__, __PRETTY_FUNCTION__, __LINE__, (test), "Condition failed: %s\n", #condition); \
+			return AST_TEST_FAIL;				\
+		}							\
+	} while(0)
+
 
 #endif /* TEST_FRAMEWORK */
 #endif /* _AST_TEST_H */

Modified: team/dlee/jansson/main/test.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/main/test.c?view=diff&rev=378913&r1=378912&r2=378913
==============================================================================
--- team/dlee/jansson/main/test.c (original)
+++ team/dlee/jansson/main/test.c Fri Jan 11 14:13:36 2013
@@ -946,15 +946,6 @@
 		file, func, line, exp);
 }
 
-enum ast_test_result_state __ast_test_check(const char *file, const char *function, int line, struct ast_test *test, const char *condition_str, enum ast_test_result_state current_res, int condition)
-{
-	if (!condition) {
-		__ast_test_status_update(file, function, line, test, "Condition failed: %s\n", condition_str);
-		return AST_TEST_FAIL;
-	}
-	return current_res;
-}
-
 #endif /* TEST_FRAMEWORK */
 
 int ast_test_init(void)

Modified: team/dlee/jansson/res/res_json.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/res/res_json.c?view=diff&rev=378913&r1=378912&r2=378913
==============================================================================
--- team/dlee/jansson/res/res_json.c (original)
+++ team/dlee/jansson/res/res_json.c Fri Jan 11 14:13:36 2013
@@ -60,6 +60,11 @@
 void ast_json_set_alloc_funcs(void *(*malloc_fn)(size_t), void (*free_fn)(void*))
 {
 	json_set_alloc_funcs(malloc_fn, free_fn);
+}
+
+void ast_json_reset_alloc_funcs(void)
+{
+	json_set_alloc_funcs(json_malloc, json_free);
 }
 
 struct ast_json *ast_json_ref(struct ast_json *json)
@@ -503,7 +508,7 @@
 static int load_module(void)
 {
 	/* Setup to use Asterisk custom allocators */
-	json_set_alloc_funcs(json_malloc, json_free);
+	ast_json_reset_alloc_funcs();
 	return AST_MODULE_LOAD_SUCCESS;
 }
 

Modified: team/dlee/jansson/tests/test_json.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/tests/test_json.c?view=diff&rev=378913&r1=378912&r2=378913
==============================================================================
--- team/dlee/jansson/tests/test_json.c (original)
+++ team/dlee/jansson/tests/test_json.c Fri Jan 11 14:13:36 2013
@@ -60,6 +60,7 @@
 	}
 	return p;
 }
+
 static void json_debug_free(void *p)
 {
 	if (p) {
@@ -67,280 +68,562 @@
 	}
 	ast_free(p);
 }
+
+static void *json_test_init(struct ast_test *test)
+{
+	ast_json_set_alloc_funcs(json_debug_malloc, json_debug_free);
+	alloc_count = 0;
+	return test;
+}
+
+static void json_test_finish(void *test)
+{
+	struct ast_test *t = test;
+	ast_json_reset_alloc_funcs();
+	if (0 != alloc_count) {
+		ast_test_status_update(t, "JSON test leaked %zd allocations!", alloc_count);
+	}
+}
+
 /*!@}*/
 
-AST_TEST_DEFINE(json_test)
-{
-	enum ast_test_result_state res = AST_TEST_PASS;
-	struct ast_json *uut = NULL;
-	struct ast_json *expected = NULL;
-	struct ast_json *tail = NULL;
-	struct ast_json *merge = NULL;
-	struct ast_json *inner_child = NULL;
-	struct ast_json_iter *iter = NULL;
-	int uut_res = 0;
-	int count = 0;
-	char *str = NULL;
-	FILE *file = NULL;
-	char *filename = NULL;
-	struct ast_str *astr = NULL;
-
-	auto void clean_vars(void);
-	/*!
-	 * Free all local variables and set to NULL. This is an inner function to give a
-	 * decent backtrace if a free() fails.
-	 */
-	void clean_vars(void) {
-		ast_json_unref(uut);
-		ast_json_unref(expected);
-		ast_json_unref(tail);
-		ast_json_unref(merge);
-		ast_json_unref(inner_child);
-		uut = expected = tail = merge = inner_child = NULL;
-		iter = NULL;
-		uut_res = count = 0;
-		json_debug_free(str);
-		str = NULL;
-		if (file) fclose(file);
-		file = NULL;
-		free(filename);
-		filename = NULL;
-		astr = NULL;
-	}
-
-	/*!
-	 * Macro to free all local variables, and check for memory leaks. This is a macro
-	 * so that ast_test_check() can get correct line numbers.
-	 */
-#define CLEAN_VARS() do {					\
-		clean_vars();					\
-		ast_test_check(res, 0 == alloc_count);		\
-		/* reset alloc_count to prevent false positives */	\
-		alloc_count = 0;				\
-	} while (0)
-
-	switch (cmd) {
-	case TEST_INIT:
-		info->name = "json";
-		info->category = "/main/json/";
-		info->summary = "Testing JSON abstraction library.";
-		info->description = "Test JSON abstraction library.";
-		return AST_TEST_NOT_RUN;
-	case TEST_EXECUTE:
-		break;
-	}
-
-	/* Setup some special malloc tracking functions. */
-	ast_json_set_alloc_funcs(json_debug_malloc, json_debug_free);
-
-	/* incref and decref should be NULL safe */
+AST_TEST_DEFINE(json_test_false)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "false";
+		info->category = "/main/json/";
+		info->summary = "Testing fundamental JSON false value.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	uut = ast_json_false();
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, AST_JSON_FALSE == ast_json_typeof(uut));
+	ast_test_validate(test, !ast_json_is_null(uut));
+	ast_test_validate(test, !ast_json_is_true(uut));
+	ast_test_validate(test, ast_json_is_false(uut));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_true)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "true";
+		info->category = "/main/json/";
+		info->summary = "Testing JSON true value.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	uut = ast_json_true();
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, AST_JSON_TRUE == ast_json_typeof(uut));
+	ast_test_validate(test, !ast_json_is_null(uut));
+	ast_test_validate(test, ast_json_is_true(uut));
+	ast_test_validate(test, !ast_json_is_false(uut));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_bool0)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "bool0";
+		info->category = "/main/json/";
+		info->summary = "Testing JSON boolean function (false).";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	uut = ast_json_boolean(0);
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, AST_JSON_FALSE == ast_json_typeof(uut));
+	ast_test_validate(test, !ast_json_is_null(uut));
+	ast_test_validate(test, !ast_json_is_true(uut));
+	ast_test_validate(test, ast_json_is_false(uut));
+	ast_test_validate(test, ast_json_equal(uut, ast_json_false()));
+	ast_test_validate(test, !ast_json_equal(uut, ast_json_true()));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_bool1)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "bool1";
+		info->category = "/main/json/";
+		info->summary = "Testing JSON boolean function (true).";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	uut = ast_json_boolean(1);
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, AST_JSON_TRUE == ast_json_typeof(uut));
+	ast_test_validate(test, !ast_json_is_null(uut));
+	ast_test_validate(test, ast_json_is_true(uut));
+	ast_test_validate(test, !ast_json_is_false(uut));
+	ast_test_validate(test, !ast_json_equal(uut, ast_json_false()));
+	ast_test_validate(test, ast_json_equal(uut, ast_json_true()));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_null)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "null";
+		info->category = "/main/json/";
+		info->summary = "Testing JSON null value.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	uut = ast_json_null();
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, AST_JSON_NULL == ast_json_typeof(uut));
+	ast_test_validate(test, ast_json_is_null(uut));
+	ast_test_validate(test, !ast_json_is_true(uut));
+	ast_test_validate(test, !ast_json_is_false(uut));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_null_val)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "null_val";
+		info->category = "/main/json/";
+		info->summary = "Testing JSON handling of NULL.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	/* NULL isn't null, true or false */
+	ast_test_validate(test, !ast_json_is_null(NULL));
+	ast_test_validate(test, !ast_json_is_false(NULL));
+	ast_test_validate(test, !ast_json_is_true(NULL));
+
+	/* ref and unref should be NULL safe */
 	ast_json_ref(NULL);
 	ast_json_unref(NULL);
-	CLEAN_VARS();
-	CLEAN_VARS();
-
-	/* Ridiculous looking tests for the fundamentals */
-	uut = ast_json_false();
-	ast_test_check(res, NULL != uut);
-	ast_test_check(res, AST_JSON_FALSE == ast_json_typeof(uut));
-	ast_test_check(res, !ast_json_is_null(uut));
-	ast_test_check(res, !ast_json_is_true(uut));
-	ast_test_check(res, ast_json_is_false(uut));
-	CLEAN_VARS();
-
-	uut = ast_json_true();
-	ast_test_check(res, NULL != uut);
-	ast_test_check(res, AST_JSON_TRUE == ast_json_typeof(uut));
-	ast_test_check(res, !ast_json_is_null(uut));
-	ast_test_check(res, ast_json_is_true(uut));
-	ast_test_check(res, !ast_json_is_false(uut));
-	CLEAN_VARS();
-
-	uut = ast_json_boolean(0);
-	ast_test_check(res, NULL != uut);
-	ast_test_check(res, AST_JSON_FALSE == ast_json_typeof(uut));
-	ast_test_check(res, !ast_json_is_null(uut));
-	ast_test_check(res, !ast_json_is_true(uut));
-	ast_test_check(res, ast_json_is_false(uut));
-	ast_test_check(res, ast_json_equal(uut, ast_json_false()));
-	ast_test_check(res, !ast_json_equal(uut, ast_json_true()));
-	CLEAN_VARS();
-
-	uut = ast_json_boolean(1);
-	ast_test_check(res, NULL != uut);
-	ast_test_check(res, AST_JSON_TRUE == ast_json_typeof(uut));
-	ast_test_check(res, !ast_json_is_null(uut));
-	ast_test_check(res, ast_json_is_true(uut));
-	ast_test_check(res, !ast_json_is_false(uut));
-	ast_test_check(res, !ast_json_equal(uut, ast_json_false()));
-	ast_test_check(res, ast_json_equal(uut, ast_json_true()));
-	CLEAN_VARS();
-
-	uut = ast_json_null();
-	ast_test_check(res, NULL != uut);
-	ast_test_check(res, AST_JSON_NULL == ast_json_typeof(uut));
-	ast_test_check(res, ast_json_is_null(uut));
-	ast_test_check(res, !ast_json_is_true(uut));
-	ast_test_check(res, !ast_json_is_false(uut));
-	CLEAN_VARS();
-
-	/* NULL isn't null, true or false */
-	ast_test_check(res, !ast_json_is_null(NULL));
-	ast_test_check(res, !ast_json_is_false(NULL));
-	ast_test_check(res, !ast_json_is_true(NULL));
-
-	/* Basic string tests */
+	/* no segfault; we're good. le sigh. */
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_string)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "string";
+		info->category = "/main/json/";
+		info->summary = "Basic string tests.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
 	uut = ast_json_string_create("Hello, json");
-	ast_test_check(res, NULL != uut);
-	ast_test_check(res, AST_JSON_STRING == ast_json_typeof(uut));
-	ast_test_check(res, 0 == strcmp("Hello, json", ast_json_string_get(uut)));
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, AST_JSON_STRING == ast_json_typeof(uut));
+	ast_test_validate(test, 0 == strcmp("Hello, json", ast_json_string_get(uut)));
 
 	uut_res = ast_json_string_set(uut, NULL);
-	ast_test_check(res, -1 == uut_res);
-	ast_test_check(res, 0 == strcmp("Hello, json", ast_json_string_get(uut)));
+	ast_test_validate(test, -1 == uut_res);
+	ast_test_validate(test, 0 == strcmp("Hello, json", ast_json_string_get(uut)));
 
 	uut_res = ast_json_string_set(uut, "Not UTF-8 - \xff");
-	ast_test_check(res, -1 == uut_res);
-	ast_test_check(res, 0 == strcmp("Hello, json", ast_json_string_get(uut)));
+	ast_test_validate(test, -1 == uut_res);
+	ast_test_validate(test, 0 == strcmp("Hello, json", ast_json_string_get(uut)));
 
 	uut_res = ast_json_string_set(uut, "Is UTF-8 - \xE2\x98\xBA");
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, 0 == strcmp("Is UTF-8 - \xE2\x98\xBA", ast_json_string_get(uut)));
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, 0 == strcmp("Is UTF-8 - \xE2\x98\xBA", ast_json_string_get(uut)));
 
 	uut_res = ast_json_string_set(uut, "Goodbye, json");
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, 0 == strcmp("Goodbye, json", ast_json_string_get(uut)));
-	CLEAN_VARS();
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, 0 == strcmp("Goodbye, json", ast_json_string_get(uut)));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_string_null)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "string_null";
+		info->category = "/main/json/";
+		info->summary = "JSON string NULL tests.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	/* NULL string */
+	uut = ast_json_string_create(NULL);
+	ast_test_validate(test, NULL == uut);
+
+	/* NULL JSON strings */
+	ast_test_validate(test, NULL == ast_json_string_create(NULL));
+	ast_test_validate(test, NULL == ast_json_string_get(NULL));
+	ast_test_validate(test, -1 == ast_json_string_set(NULL, "not null"));
+
+	/* string_value from non-string elements should return NULL */
+	ast_test_validate(test, NULL == ast_json_string_get(ast_json_null()));
+	ast_test_validate(test, NULL == ast_json_string_get(ast_json_false()));
+	ast_test_validate(test, NULL == ast_json_string_get(ast_json_true()));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_stringf)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "stringf";
+		info->category = "/main/json/";
+		info->summary = "Basic string formatting tests.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	/* NULL format string */
+	uut = ast_json_stringf(NULL);
+	ast_test_validate(test, NULL == uut);
+
+	/* Non-UTF-8 strings are invalid */
+	uut = ast_json_stringf("Not UTF-8 - %s", "\xff");
+	ast_test_validate(test, NULL == uut);
 
 	/* formatted string */
 	uut = ast_json_stringf("Hello, %s", "json");
 	expected = ast_json_string_create("Hello, json");
-	ast_test_check(res, NULL != uut);
-	ast_test_check(res, ast_json_equal(expected, uut));
-	CLEAN_VARS();
-
-	/* Non-UTF-8 strings are invalid */
-	uut = ast_json_stringf("Not UTF-8 - %s", "\xff");
-	ast_test_check(res, NULL == uut);
-	CLEAN_VARS();
-
-	/* NULL string */
-	uut = ast_json_string_create(NULL);
-	ast_test_check(res, NULL == uut);
-	CLEAN_VARS();
-
-	/* NULL format string */
-	uut = ast_json_stringf(NULL);
-	ast_test_check(res, NULL == uut);
-	CLEAN_VARS();
-
-	/* NULL JSON strings */
-	ast_test_check(res, NULL == ast_json_string_create(NULL));
-	ast_test_check(res, NULL == ast_json_string_get(NULL));
-	ast_test_check(res, -1 == ast_json_string_set(NULL, "not null"));
-
-	/* string_value from non-string elements should return NULL */
-	ast_test_check(res, NULL == ast_json_string_get(ast_json_null()));
-	ast_test_check(res, NULL == ast_json_string_get(ast_json_false()));
-	ast_test_check(res, NULL == ast_json_string_get(ast_json_true()));
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, ast_json_equal(expected, uut));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_int)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "int";
+		info->category = "/main/json/";
+		info->summary = "Basic JSON integer tests.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* Integer tests */
 	uut = ast_json_integer_create(0);
-	ast_test_check(res, NULL != uut);
-	ast_test_check(res, AST_JSON_INTEGER == ast_json_typeof(uut));
-	ast_test_check(res, 0 == ast_json_integer_get(uut));
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, AST_JSON_INTEGER == ast_json_typeof(uut));
+	ast_test_validate(test, 0 == ast_json_integer_get(uut));
 
 	uut_res = ast_json_integer_set(uut, 1);
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, 1 == ast_json_integer_get(uut));
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, 1 == ast_json_integer_get(uut));
 
 	uut_res = ast_json_integer_set(uut, -1);
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, -1 == ast_json_integer_get(uut));
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, -1 == ast_json_integer_get(uut));
 
 	uut_res = ast_json_integer_set(uut, LLONG_MAX);
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, LLONG_MAX == ast_json_integer_get(uut));
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, LLONG_MAX == ast_json_integer_get(uut));
 
 	uut_res = ast_json_integer_set(uut, LLONG_MIN);
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, LLONG_MIN == ast_json_integer_get(uut));
-	CLEAN_VARS();
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, LLONG_MIN == ast_json_integer_get(uut));
+
+	ast_json_unref(uut);
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_non_int)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "non_int";
+		info->category = "/main/json/";
+		info->summary = "Testing integer functions with non-integer types.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* Non-ints return 0 integer value */
-	ast_test_check(res, 0 == ast_json_integer_get(ast_json_null()));
-	ast_test_check(res, 0 == ast_json_integer_get(ast_json_true()));
-	ast_test_check(res, 0 == ast_json_integer_get(ast_json_false()));
+	ast_test_validate(test, 0 == ast_json_integer_get(ast_json_null()));
+	ast_test_validate(test, 0 == ast_json_integer_get(ast_json_true()));
+	ast_test_validate(test, 0 == ast_json_integer_get(ast_json_false()));
 
 	/* JSON NULL integers */
-	ast_test_check(res, 0 == ast_json_integer_get(NULL));
-	ast_test_check(res, -1 == ast_json_integer_set(NULL, 911));
-	ast_test_check(res, 0 == ast_json_array_size(NULL));
+	ast_test_validate(test, 0 == ast_json_integer_get(NULL));
+	ast_test_validate(test, -1 == ast_json_integer_set(NULL, 911));
+	ast_test_validate(test, 0 == ast_json_array_size(NULL));
 
 	/* No magical parsing of strings into ints */
 	uut = ast_json_string_create("314");
-	ast_test_check(res, 0 == ast_json_integer_get(uut));
-	CLEAN_VARS();
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, 0 == ast_json_integer_get(uut));
 
 	/* Or vice-versa */
+	ast_json_unref(uut);
 	uut = ast_json_integer_create(314);
-	ast_test_check(res, NULL == ast_json_string_get(uut));
-	CLEAN_VARS();
+	ast_test_validate(test, NULL == ast_json_string_get(uut));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_array_create)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "array_create";
+		info->category = "/main/json/";
+		info->summary = "Testing creating JSON arrays.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* array creation */
 	uut = ast_json_array_create();
-	ast_test_check(res, NULL != uut);
-	ast_test_check(res, AST_JSON_ARRAY == ast_json_typeof(uut));
-	ast_test_check(res, 0 == ast_json_array_size(uut));
-	CLEAN_VARS();
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, AST_JSON_ARRAY == ast_json_typeof(uut));
+	ast_test_validate(test, 0 == ast_json_array_size(uut));
+
+	ast_json_unref(uut);
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_array_append)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "array_append";
+		info->category = "/main/json/";
+		info->summary = "Testing appending to JSON arrays.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* array append */
 	uut = ast_json_array_create();
 	uut_res = ast_json_array_append(uut, ast_json_string_create("one"));
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, 1 == ast_json_array_size(uut));
-	ast_test_check(res, 0 == strcmp("one", ast_json_string_get(ast_json_array_get(uut, 0))));
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, 1 == ast_json_array_size(uut));
+	ast_test_validate(test, 0 == strcmp("one", ast_json_string_get(ast_json_array_get(uut, 0))));
 	/* index out of range */
-	ast_test_check(res, NULL == ast_json_array_get(uut, 1));
-	ast_test_check(res, NULL == ast_json_array_get(uut, -1));
-	CLEAN_VARS();
+	ast_test_validate(test, NULL == ast_json_array_get(uut, 1));
+	ast_test_validate(test, NULL == ast_json_array_get(uut, -1));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_array_inset)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "array_insert";
+		info->category = "/main/json/";
+		info->summary = "Testing inserting into JSON arrays.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* array insert */
 	uut = ast_json_pack("[s]", "one");
 	uut_res = ast_json_array_insert(uut, 0, ast_json_string_create("zero"));
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, 2 == ast_json_array_size(uut));
-	ast_test_check(res, 0 == strcmp("zero", ast_json_string_get(ast_json_array_get(uut, 0))));
-	ast_test_check(res, 0 == strcmp("one", ast_json_string_get(ast_json_array_get(uut, 1))));
-	CLEAN_VARS();
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, 2 == ast_json_array_size(uut));
+	ast_test_validate(test, 0 == strcmp("zero", ast_json_string_get(ast_json_array_get(uut, 0))));
+	ast_test_validate(test, 0 == strcmp("one", ast_json_string_get(ast_json_array_get(uut, 1))));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_array_set)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "array_set";
+		info->category = "/main/json/";
+		info->summary = "Testing setting a value in JSON arrays.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* array set */
 	uut = ast_json_pack("[s, s]", "zero", "one");
 	uut_res = ast_json_array_set(uut, 1, ast_json_integer_create(1));
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, 2 == ast_json_array_size(uut));
-	ast_test_check(res, 0 == strcmp("zero", ast_json_string_get(ast_json_array_get(uut, 0))));
-	ast_test_check(res, 1 == ast_json_integer_get(ast_json_array_get(uut, 1)));
-	CLEAN_VARS();
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, 2 == ast_json_array_size(uut));
+	ast_test_validate(test, 0 == strcmp("zero", ast_json_string_get(ast_json_array_get(uut, 0))));
+	ast_test_validate(test, 1 == ast_json_integer_get(ast_json_array_get(uut, 1)));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_array_remove)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "array_remove";
+		info->category = "/main/json/";
+		info->summary = "Testing removing a value from JSON arrays.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* array remove */
-	uut = ast_json_array_create();
-	uut_res = ast_json_array_append(uut, ast_json_string_create("zero"));
-	uut_res = ast_json_array_append(uut, ast_json_integer_create(1));
+	uut = ast_json_pack("[s, i]", "zero", 1);
+	expected = ast_json_pack("[i]", 1);
 	uut_res = ast_json_array_remove(uut, 0);
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, 1 == ast_json_array_size(uut));
-	ast_test_check(res, 1 == ast_json_integer_get(ast_json_array_get(uut, 0)));
-	CLEAN_VARS();
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, ast_json_equal(expected, uut));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_array_clear)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "array_clear";
+		info->category = "/main/json/";
+		info->summary = "Testing clearing JSON arrays.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* array clear */
-	uut = ast_json_array_create();
-	uut_res = ast_json_array_append(uut, ast_json_string_create("zero"));
-	uut_res = ast_json_array_append(uut, ast_json_integer_create(1));
+	uut = ast_json_pack("[s, s]", "zero", "one");
 	uut_res = ast_json_array_clear(uut);
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, 0 == ast_json_array_size(uut));
-	CLEAN_VARS();
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, 0 == ast_json_array_size(uut));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_array_extend)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, tail, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "array_extend";
+		info->category = "/main/json/";
+		info->summary = "Testing extending JSON arrays.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* array extending */
 	expected = ast_json_array_create();
@@ -362,70 +645,201 @@
 	ast_json_array_append(tail, ast_json_integer_create(3));
 
 	uut_res = ast_json_array_extend(uut, tail);
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, ast_json_equal(expected, uut));
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, ast_json_equal(expected, uut));
 	/* tail is preserved */
-	ast_test_check(res, 3 == ast_json_array_size(tail));
-	CLEAN_VARS();
+	ast_test_validate(test, 3 == ast_json_array_size(tail));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_array_null)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "array_null";
+		info->category = "/main/json/";
+		info->summary = "Testing NULL conditions for JSON arrays.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* array NULL checks */
-	ast_test_check(res, 0 == ast_json_array_size(NULL));
-	ast_test_check(res, NULL == ast_json_array_get(NULL, 0));
-	ast_test_check(res, -1 == ast_json_array_set(NULL, 0, ast_json_null()));
-	ast_test_check(res, -1 == ast_json_array_append(NULL, ast_json_null()));
-	ast_test_check(res, -1 == ast_json_array_insert(NULL, 0, ast_json_null()));
-	ast_test_check(res, -1 == ast_json_array_remove(NULL, 0));
-	ast_test_check(res, -1 == ast_json_array_clear(NULL));
+	ast_test_validate(test, 0 == ast_json_array_size(NULL));
+	ast_test_validate(test, NULL == ast_json_array_get(NULL, 0));
+	ast_test_validate(test, -1 == ast_json_array_set(NULL, 0, ast_json_null()));
+	ast_test_validate(test, -1 == ast_json_array_append(NULL, ast_json_null()));
+	ast_test_validate(test, -1 == ast_json_array_insert(NULL, 0, ast_json_null()));
+	ast_test_validate(test, -1 == ast_json_array_remove(NULL, 0));
+	ast_test_validate(test, -1 == ast_json_array_clear(NULL));
 	uut = ast_json_array_create();
-	ast_test_check(res, -1 == ast_json_array_extend(uut, NULL));
-	ast_test_check(res, -1 == ast_json_array_extend(NULL, uut));
-	ast_test_check(res, -1 == ast_json_array_extend(NULL, NULL));
-	CLEAN_VARS();
+	ast_test_validate(test, -1 == ast_json_array_extend(uut, NULL));
+	ast_test_validate(test, -1 == ast_json_array_extend(NULL, uut));
+	ast_test_validate(test, -1 == ast_json_array_extend(NULL, NULL));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_object_alloc)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "object_alloc";
+		info->category = "/main/json/";
+		info->summary = "Testing creating JSON objects.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* object allocation */
 	uut = ast_json_object_create();
-	ast_test_check(res, NULL != uut);
-	ast_test_check(res, AST_JSON_OBJECT == ast_json_typeof(uut));
-	ast_test_check(res, 0 == ast_json_object_size(uut));
-	CLEAN_VARS();
+	ast_test_validate(test, NULL != uut);
+	ast_test_validate(test, AST_JSON_OBJECT == ast_json_typeof(uut));
+	ast_test_validate(test, 0 == ast_json_object_size(uut));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_object_set)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "object_set";
+		info->category = "/main/json/";
+		info->summary = "Testing setting values in JSON objects.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* object set */
 	expected = ast_json_pack("{s: i, s: i, s: i}", "one", 1, "two", 2, "three", 3);
 	uut = ast_json_object_create();
 	uut_res = ast_json_object_set(uut, "one", ast_json_integer_create(1));
-	ast_test_check(res, 0 == uut_res);
+	ast_test_validate(test, 0 == uut_res);
 	uut_res = ast_json_object_set(uut, "two", ast_json_integer_create(2));
-	ast_test_check(res, 0 == uut_res);
+	ast_test_validate(test, 0 == uut_res);
 	uut_res = ast_json_object_set(uut, "three", ast_json_integer_create(3));
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, ast_json_equal(expected, uut));
-	ast_test_check(res, NULL == ast_json_object_get(uut, "dne"));
-	CLEAN_VARS();
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, ast_json_equal(expected, uut));
+	ast_test_validate(test, NULL == ast_json_object_get(uut, "dne"));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_object_set_overwrite)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "object_set_overwriting";
+		info->category = "/main/json/";
+		info->summary = "Testing changing values in JSON objects.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* object set existing */
 	uut = ast_json_pack("{s: i, s: i, s: i}", "one", 1, "two", 2, "three", 3);
 	uut_res = ast_json_object_set(uut, "two", ast_json_integer_create(-2));
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, -2 == ast_json_integer_get(ast_json_object_get(uut, "two")));
-	CLEAN_VARS();
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, -2 == ast_json_integer_get(ast_json_object_get(uut, "two")));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_object_get)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "object_get";
+		info->category = "/main/json/";
+		info->summary = "Testing getting values from JSON objects.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* object get */
 	uut = ast_json_pack("{s: i, s: i, s: i}", "one", 1, "two", 2, "three", 3);
-	ast_test_check(res, 2 == ast_json_integer_get(ast_json_object_get(uut, "two")));
-	ast_test_check(res, NULL == ast_json_object_get(uut, "dne"));
-	ast_test_check(res, NULL == ast_json_object_get(uut, NULL));
-	CLEAN_VARS();
+	ast_test_validate(test, 2 == ast_json_integer_get(ast_json_object_get(uut, "two")));
+	ast_test_validate(test, NULL == ast_json_object_get(uut, "dne"));
+	ast_test_validate(test, NULL == ast_json_object_get(uut, NULL));
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_object_del)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "object_del";
+		info->category = "/main/json/";
+		info->summary = "Testing deleting values from JSON objects.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* object del */
 	expected = ast_json_object_create();
-	uut = ast_json_object_create();
-	uut_res = ast_json_object_set(uut, "one", ast_json_integer_create(1));
+	uut = ast_json_pack("{s: i}", "one", 1);
 	uut_res = ast_json_object_del(uut, "one");
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, ast_json_equal(expected, uut));
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, ast_json_equal(expected, uut));
 	uut_res = ast_json_object_del(uut, "dne");
-	ast_test_check(res, -1 == uut_res);
-	CLEAN_VARS();
+	ast_test_validate(test, -1 == uut_res);
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(json_test_object_clear)
+{
+	RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+	RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+	int uut_res;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "object_clear";
+		info->category = "/main/json/";
+		info->summary = "Testing clearing values from JSON objects.";
+		info->description = "Test JSON abstraction library.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
 
 	/* object clear */
 	uut = ast_json_object_create();
@@ -433,9 +847,30 @@
 	ast_json_object_set(uut, "two", ast_json_integer_create(2));
 	ast_json_object_set(uut, "three", ast_json_integer_create(3));
 	uut_res = ast_json_object_clear(uut);
-	ast_test_check(res, 0 == uut_res);
-	ast_test_check(res, 0 == ast_json_object_size(uut));
-	CLEAN_VARS();
+	ast_test_validate(test, 0 == uut_res);
+	ast_test_validate(test, 0 == ast_json_object_size(uut));
+
+	return AST_TEST_PASS;
+}
+

[... 939 lines stripped ...]



More information about the asterisk-commits mailing list