MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / main

Function main

tests/unittests/test_zipenhancer_utility.cpp:95–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93} // namespace
94
95int 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}

Callers

nothing calls this directly

Calls 8

repo_pathFunction · 0.70
cuda_backendFunction · 0.70
asset_pathFunction · 0.70
requireFunction · 0.70
run_caseFunction · 0.70
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected