| 93 | } // namespace |
| 94 | |
| 95 | int main() { |
| 96 | try { |
| 97 | const auto model = engine::audio::ZipEnhancerModel::load_from_directory( |
| 98 | repo_path("assets/framework/audio_utilities/zipenhancer"), |
| 99 | cuda_backend()); |
| 100 | const auto fixture_dir = asset_path("framework/audio_utilities/zipenhancer"); |
| 101 | std::vector<int> cases; |
| 102 | for (const auto & entry : std::filesystem::directory_iterator(fixture_dir)) { |
| 103 | const auto name = entry.path().filename().string(); |
| 104 | constexpr const char * prefix = "zipenhancer_case"; |
| 105 | constexpr const char * suffix = ".safetensors"; |
| 106 | if (name.rfind(prefix, 0) != 0 || |
| 107 | name.size() <= std::char_traits<char>::length(prefix) + std::char_traits<char>::length(suffix) || |
| 108 | name.substr(name.size() - std::char_traits<char>::length(suffix)) != suffix) { |
| 109 | continue; |
| 110 | } |
| 111 | const auto index = name.substr( |
| 112 | std::char_traits<char>::length(prefix), |
| 113 | name.size() - std::char_traits<char>::length(prefix) - std::char_traits<char>::length(suffix)); |
| 114 | cases.push_back(std::stoi(index)); |
| 115 | } |
| 116 | std::sort(cases.begin(), cases.end()); |
| 117 | require(cases.size() >= 2, "ZipEnhancer requires at least two reference fixtures"); |
| 118 | for (const int case_index : cases) { |
| 119 | run_case(model, case_index); |
| 120 | } |
| 121 | std::cout << "zipenhancer_utility_test passed\n"; |
| 122 | } catch (const std::exception & ex) { |
| 123 | std::cerr << "zipenhancer_utility_test failed: " << ex.what() << "\n"; |
| 124 | return 1; |
| 125 | } |
| 126 | return 0; |
| 127 | } |
nothing calls this directly
no test coverage detected