// Print label dataset void AH5_print_lbl_dataset (const AH5_lbl_dataset_t *lbl_dataset, int space) { hsize_t i; printf("%*sName: %s\n", space, "", AH5_get_name_from_path(lbl_dataset->path)); for (i = 0; i < lbl_dataset->nb_items; i++) printf("%*s%s\n", space + 3, "", lbl_dataset->items[i]); printf("\n"); }
// Print localizationSystem instance void AH5_print_lsm_instance (const AH5_lsm_instance_t *lsm_instance, int space) { hsize_t i; printf("%*sInstance: %s\n", space, "", AH5_get_name_from_path(lsm_instance->path)); AH5_print_int_attr(AH5_A_DIMENSION, lsm_instance->dimension, space + 4); AH5_print_opt_attrs(&(lsm_instance->opt_attrs), space + 4); for (i = 0; i < lsm_instance->nb_transformations; i++) AH5_print_lsm_transformation(&(lsm_instance->transformations[i]), space + 2); }
// Print dataset in externalElement void AH5_print_eet_dataset (const AH5_eet_dataset_t *eet_dataset, int space) { hsize_t i; printf("%*sInstance: %s\n", space, "", AH5_get_name_from_path(eet_dataset->path)); for (i = 0; i < eet_dataset->nb_eed_items; i++) { printf("%*sId %lu:\n", space + 3, "", (long unsigned) i); printf("%*s-internal: %s\n", space + 6, "", eet_dataset->eed_items[AH5_EE_INTERNAL_NAME(i)]); printf("%*s-external: %s:%s\n", space + 6, "", eet_dataset->eed_items[AH5_EE_EXTERNAL_FILE_NAME(i)], eet_dataset->eed_items[AH5_EE_EXTERNAL_NAME(i)]); printf("%*s-file_id: %i\n\n", space + 6, "",eet_dataset->file_id[i]); } }
char *test_get_base_or_name_from_path() { char path[AH5_ABSOLUTE_PATH_LENGTH]; char g0[] = "/base"; char g1[] = "g1"; char g2[] = "/g2 "; // init null string path[0] = '\0'; mu_assert_str_equal("get name on NULL.", AH5_get_name_from_path(path), ""); mu_assert_str_equal("get base on NULL.", AH5_get_base_from_path(path), ""); AH5_join_path(path, g0); // path <- "" + "/base" mu_assert_str_equal("get name at root node.", AH5_get_name_from_path(path), "base"); mu_assert_str_equal("get base at root node.", AH5_get_base_from_path(path), ""); AH5_join_path(path, g1); // path <- "/base" + "/" + "g1" mu_assert_str_equal("get name from path with two nodes deep.", AH5_get_name_from_path(path), "g1"); mu_assert_str_equal("get name from path with two nodes deep.", AH5_get_base_from_path(path), "/base"); AH5_join_path(path, g2); // path <- "/base/g1" + "/g2 " mu_assert_str_equal("get name from path with 3th nodes deep ans white space.", AH5_get_name_from_path(path), "g2 "); mu_assert_str_equal("get base from path with 3th nodes deep ans white space.", AH5_get_base_from_path(path), "/base/g1"); return 0; }
// Print localizationSystem transformation void AH5_print_lsm_transformation (const AH5_lsm_transf_t *lsm_transformation, int space) { printf("%*sTransformation: %s\n", space, "", AH5_get_name_from_path(lsm_transformation->path)); AH5_print_int_attr(AH5_A_RANK, lsm_transformation->rank, space + 3); switch (lsm_transformation->type) { case TRF_SCALE: AH5_print_str_attr(AH5_A_TYPE, AH5_V_SCALE, space + 3); break; case TRF_ROTATION: AH5_print_str_attr(AH5_A_TYPE, AH5_V_ROTATION, space + 3); break; case TRF_TRANSLATION: AH5_print_str_attr(AH5_A_TYPE, AH5_V_TRANSLATION, space + 3); break; default: AH5_print_str_attr(AH5_A_TYPE, AH5_V_INVALID, space + 3); break; } }
// Print simulation instance void AH5_print_sim_instance (const AH5_sim_instance_t *sim_instance, int space) { hsize_t i; printf("%*sInstance: %s\n", space, "", AH5_get_name_from_path(sim_instance->path)); AH5_print_opt_attrs(&(sim_instance->opt_attrs), space + 4); AH5_print_str_attr(AH5_A_MODULE, sim_instance->module, space + 4); AH5_print_str_attr(AH5_A_VERSION, sim_instance->version, space + 4); if (sim_instance->nb_inputs > 0) { printf("%*sInputs:\n", space + 2, ""); for (i = 0; i < sim_instance->nb_inputs; i++) printf("%*s%s\n", space + 5, " ", sim_instance->inputs[i]); } if (sim_instance->nb_outputs > 0) { printf("%*sOutputs:\n", space + 2, ""); for (i = 0; i < sim_instance->nb_outputs; i++) printf("%*s%s\n", space + 5, "", sim_instance->outputs[i]); } printf("\n"); }