Exemplo n.º 1
0
static void compare_node(const void *fdt1, int offset1,
			 const void *fdt2, int offset2)
{
	int err;
	char path1[PATH_MAX], path2[PATH_MAX];

	CHECK(fdt_get_path(fdt1, offset1, path1, sizeof(path1)));
	CHECK(fdt_get_path(fdt2, offset2, path2, sizeof(path2)));

	if (!streq(path1, path2))
		TEST_BUG("Path mismatch %s vs. %s\n", path1, path2);

	verbose_printf("Checking %s\n", path1);

	compare_properties(fdt1, offset1, fdt2, offset2);
	compare_properties(fdt2, offset2, fdt1, offset1);

	compare_subnodes(fdt1, offset1, fdt2, offset2, 1);
	compare_subnodes(fdt2, offset2, fdt1, offset1, 0);
}
Exemplo n.º 2
0
static void
surface_assert_equal(const GwySurface *result,
                     const GwySurface *reference)
{
    g_assert(GWY_IS_SURFACE(result));
    g_assert(GWY_IS_SURFACE(reference));
    g_assert_cmpuint(result->n, ==, reference->n);
    compare_properties(G_OBJECT(result), G_OBJECT(reference));

    for (guint i = 0; i < result->n; i++) {
        GwyXYZ resxy = result->data[i];
        GwyXYZ refxy = reference->data[i];
        g_assert_cmpfloat(resxy.x, ==, refxy.x);
        g_assert_cmpfloat(resxy.y, ==, refxy.y);
        g_assert_cmpfloat(resxy.z, ==, refxy.z);
    }
}
Exemplo n.º 3
0
void
int_set_assert_equal(const GwyIntSet *result,
                     const GwyIntSet *reference)
{
    g_assert(GWY_IS_INT_SET(result));
    g_assert(GWY_IS_INT_SET(reference));
    g_assert_cmpuint(gwy_int_set_size(result), ==, gwy_int_set_size(reference));
    compare_properties(G_OBJECT(result), G_OBJECT(reference));

    guint nres, nref;
    gint *resvalues = gwy_int_set_values(result, &nres);
    gint *refvalues = gwy_int_set_values(reference, &nref);
    g_assert_cmpuint(nres, ==, nref);

    for (guint i = 0; i < nref; i++) {
        g_assert_cmpint(resvalues[i], ==, refvalues[i]);
    }
    g_free(refvalues);
    g_free(resvalues);
}