Exemplo n.º 1
0
/* ----- Auxiliary functions. ----- */
static void
test_construction(NModule* mod, uint32_t entry, uint8_t nlocals) {
	NError error;
	NModule* out_mod;
	uint32_t out_entry;
	uint8_t  out_nlocals;
	NProcedure* proc = n_procedure_new(mod, entry, nlocals, &error);
	EXPECT_MSG(error.code == N_E_OK,
		"Procedure construction (%p, %u, %u) generated error code %u.",
		mod, entry, nlocals, error.code);

	ASSERT(proc != NULL);
	ASSERT_MSG(n_is_procedure(n_wrap_pointer(proc)),
		"Procedure constructed from module %p, with entry point %u and %u "
		"locals failed to be recognized as procedure.",
		mod, entry, nlocals);

	out_mod = n_procedure_get_module(proc);
	out_entry = n_procedure_get_entry_point(proc);
	out_nlocals = n_procedure_count_locals(proc);

	EXPECT_MSG(mod == out_mod,
		"Procedure constructed with module %p got module reported as %p.",
		mod, out_mod);
	EXPECT_MSG(entry == out_entry,
		"Procedure constructed with entry point %u got entry point "
		"reported as %u.",
		entry, out_entry);
	EXPECT_MSG(nlocals == out_nlocals,
		"Procedure constructed with locals count %u got locals count "
		"reported as %u.",
		nlocals, out_nlocals);
}
Exemplo n.º 2
0
DD_TEST(is_procedure_rejects_other, other_iter, NValue, value) {
    ASSERT(IS_TRUE(!n_is_procedure(*value)));
}