MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / CompareFloats

Function CompareFloats

tests/cpu/Baker_tests.cpp:17–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15namespace
16{
17void CompareFloats(const std::string& floats1, const std::string& floats2)
18{
19 // Number comparison.
20 const StringUtils::StringVec strings1 = StringUtils::SplitByWhiteSpaces(StringUtils::Trim(floats1));
21 std::vector<float> numbers1;
22 OCIO::StringVecToFloatVec(numbers1, strings1);
23
24 const StringUtils::StringVec strings2 = StringUtils::SplitByWhiteSpaces(StringUtils::Trim(floats2));
25 std::vector<float> numbers2;
26 OCIO::StringVecToFloatVec(numbers2, strings2);
27
28 OCIO_CHECK_EQUAL(numbers1.size(), numbers2.size());
29 for (unsigned int j = 0; j<numbers1.size(); ++j)
30 {
31 OCIO_CHECK_CLOSE(numbers1[j], numbers2[j], 1e-5f);
32 }
33}
34}
35
36OCIO_ADD_TEST(Baker, bake_3dlut)

Callers 1

OCIO_ADD_TESTFunction · 0.85

Calls 4

SplitByWhiteSpacesFunction · 0.85
TrimFunction · 0.50
StringVecToFloatVecFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected