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

Function require_close

tests/unittests/test_torch_random.cpp:12–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace {
11
12void require_close(float actual, float expected, float tolerance, const char * label) {
13 if (std::fabs(actual - expected) > tolerance) {
14 throw std::runtime_error(
15 std::string(label) + " mismatch: expected " + std::to_string(expected) +
16 ", got " + std::to_string(actual));
17 }
18}
19
20void require_vector_close(
21 const std::vector<float> & actual,

Calls 2

stringFunction · 0.50
to_stringFunction · 0.50

Tested by

no test coverage detected