Inspect: support to print the exu diff result to standard output

Summary: This is helpful to get simple result of .exu diff without file access

Test Plan: exactness_inspect --compare test.exu test.compare.exu --output=out.exu

Reviewers: jsuya, JackDanielZ

Reviewed By: JackDanielZ

Subscribers: myoungwoon, akanad, bowonryu

Differential Revision: https://phab.enlightenment.org/D7239
master
Yeongjong Lee 4 years ago committed by Daniel Zaoui
parent 433d843898
commit 12af68f993
  1. 66
      src/bin/inspect.c

@ -1119,6 +1119,71 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
}
}
static void
_diff_result_print(Exactness_Unit *unit1, Exactness_Unit *unit2)
{
Eina_List *itr1, *itr2;
int nb_scenario = 0, nb_diff_scenario = 0;
int nb_image = 0, nb_diff_image = 0;
int nb_objtree= 0, nb_diff_objtree = 0;
itr1 = unit1 ? unit1->actions : NULL;
itr2 = unit2 ? unit2->actions : NULL;
while (itr1 || itr2)
{
Exactness_Action *v1 = itr1 ? eina_list_data_get(itr1) : NULL;
Exactness_Action *v2 = itr2 ? eina_list_data_get(itr2) : NULL;
nb_scenario++;
if (_are_scenario_entries_different(v1, v2))
nb_diff_scenario++;
if (itr1) itr1 = eina_list_next(itr1);
if (itr2) itr2 = eina_list_next(itr2);
}
itr1 = unit1 ? unit1->imgs : NULL;
itr2 = unit2 ? unit2->imgs : NULL;
while (itr1 || itr2)
{
Exactness_Image *img1 = itr1 ? eina_list_data_get(itr1) : NULL;
Exactness_Image *img2 = itr2 ? eina_list_data_get(itr2) : NULL;
nb_image++;
if (_are_images_different(img1, img2))
nb_diff_image++;
if (itr1) itr1 = eina_list_next(itr1);
if (itr2) itr2 = eina_list_next(itr2);
}
itr1 = unit1 ? unit1->objs : NULL;
itr2 = unit2 ? unit2->objs : NULL;
while (itr1 || itr2)
{
Exactness_Objects *objs1 = itr1 ? eina_list_data_get(itr1) : NULL;
Exactness_Objects *objs2 = itr2 ? eina_list_data_get(itr2) : NULL;
nb_objtree++;
if (_are_objs_trees_different(objs1, objs2))
nb_diff_objtree++;
if (itr1) itr1 = eina_list_next(itr1);
if (itr2) itr2 = eina_list_next(itr2);
}
printf("%s\nscenario (%d/%d)\nimage (%d/%d)\nobjs_tree (%d/%d)\n",
nb_diff_scenario || nb_diff_image || nb_diff_objtree ?
"Failure" : "Success",
nb_scenario - nb_diff_scenario, nb_scenario,
nb_image - nb_diff_image, nb_image,
nb_objtree - nb_diff_objtree, nb_objtree);
}
static Exactness_Image *
_image_read(const char *filename)
{
@ -1498,6 +1563,7 @@ main(int argc, char *argv[])
}
else if (!strcmp(out_ext, ".exu"))
{
_diff_result_print(unit1, unit2);
if (unitO) exactness_unit_file_write(unitO, output);
else ret = 0;
}

Loading…
Cancel
Save