MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / test_export_sample

Function test_export_sample

tests/test_resource_export.cpp:13–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11namespace TestResourceExport {
12
13Error test_export_sample(const String &version) {
14 String test_dir = get_test_resources_path().path_join(version).path_join("sample");
15 Vector<String> files = gdre::get_recursive_dir_list(test_dir, { "*.sample" });
16 String output_dir = get_tmp_path().path_join(version).path_join("sample");
17 for (const String &file : files) {
18 // original file
19 String original_file = file.rsplit("-", true, 1)[0];
20 String output_file = output_dir.path_join(original_file.get_file());
21 Error err = Exporter::export_file(output_file, file);
22 CHECK(err == OK);
23 // load the sample file, not the wav
24 Ref<AudioStreamWAV> original_sample = ResourceCompatLoader::non_global_load(file);
25 CHECK(original_sample.is_valid());
26 Ref<AudioStreamWAV> exported_sample = AudioStreamWAV::load_from_file(output_file, {});
27 CHECK(exported_sample.is_valid());
28 CHECK(original_sample->get_data() == exported_sample->get_data());
29 }
30 return OK;
31}
32
33Error test_export_oggvorbisstr(const String &version) {
34 String test_dir = get_test_resources_path().path_join(version).path_join("ogg");

Callers 1

Calls 5

get_test_resources_pathFunction · 0.85
get_tmp_pathFunction · 0.85
get_fileMethod · 0.45
is_validMethod · 0.45
get_dataMethod · 0.45

Tested by

no test coverage detected