static int do_cmp(const char **paths) { size_t content_size[MAX_TYPES]; int elemnr, type, err; for (type = PATH1; type < MAX_TYPES; type++) { content_size[type] = get_content_copy(paths[type], type); if (content_size[type] < 0) return content_size[type]; assign_types(type, content_size[type]); } if (content_size[PATH1] != content_size[PATH2]) { fprintf(stderr, "Both ramdisks must contain the same amount of regular files!\ \n(number of regular files in %s: %zu, number of regular files in %s: %zu)\n", paths[PATH1], content_size[PATH1], paths[PATH2], content_size[PATH2]); for (elemnr = 0; elemnr < content_size[PATH1]; elemnr++) { if (!memcmp(rd.type[PATH1][elemnr], TYPE_OTHER, OTHER_SZ - 1)) { if (!files_equal(rd.elem[PATH1][elemnr], rd.elem[PATH2][elemnr])) { fprintf(stdout, "Starting at: %s with %s\n", rd.elem[PATH1][elemnr], rd.elem[PATH2][elemnr]); break; } } } return EXIT_FAILURE; }
void test_load_file() { remove_temp_file(); xlnt::zip_file f(existing_file); f.save(temp_file.GetFilename()); TS_ASSERT(files_equal(existing_file, temp_file.GetFilename())); remove_temp_file(); }
void test_load_stream() { remove_temp_file(); { std::ifstream in_stream(existing_file, std::ios::binary); xlnt::zip_file f(in_stream); std::ofstream out_stream(temp_file.GetFilename(), std::ios::binary); f.save(out_stream); } TS_ASSERT(files_equal(existing_file, temp_file.GetFilename())); remove_temp_file(); }