diff options
author | Slava Shklyaev <slavash@google.com> | 2018-10-16 12:17:36 +0100 |
---|---|---|
committer | Xusong Wang <xusongw@google.com> | 2018-11-09 20:29:00 -0800 |
commit | 543b117ed0e20099a1c9a53693f92c8511591c64 (patch) | |
tree | 35389aa6236f056a7fb1a2cb6746dc7de3641696 | |
parent | 51b78bfc91498b33b4d6f1aae9880e8453b7adaa (diff) | |
download | ml-543b117ed0e20099a1c9a53693f92c8511591c64.tar.gz |
Improve gTest error messages
Test: NeuralNetworksTest_static
Change-Id: I0aa7b34f407c7b4d996b43720b66b470d15ecbfc
Merged-In: I0aa7b34f407c7b4d996b43720b66b470d15ecbfc
(cherry picked from commit 1960d4181f2fd56d9f72bc9fd6c02efc23648124)
-rw-r--r-- | nn/tools/test_generator/include/TestHarness.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/nn/tools/test_generator/include/TestHarness.h b/nn/tools/test_generator/include/TestHarness.h index 7099996a5..f10e9efef 100644 --- a/nn/tools/test_generator/include/TestHarness.h +++ b/nn/tools/test_generator/include/TestHarness.h @@ -188,29 +188,29 @@ void compare_( inline void compare(const MixedTyped& golden, const MixedTyped& test, float fpAtol = 1e-5f, float fpRtol = 1e-5f) { size_t totalNumberOfErrors = 0; - compare_<0>(golden, test, [&totalNumberOfErrors, fpAtol, fpRtol](float g, float t) { + compare_<0>(golden, test, [&totalNumberOfErrors, fpAtol, fpRtol](float expected, float actual) { // Compute the range based on both absolute tolerance and relative tolerance - float fpRange = fpAtol + fpRtol * std::abs(g); + float fpRange = fpAtol + fpRtol * std::abs(expected); if (totalNumberOfErrors < gMaximumNumberOfErrorMessages) { - EXPECT_NEAR(g, t, fpRange); + EXPECT_NEAR(expected, actual, fpRange); } - if (std::abs(g - t) > fpRange) { + if (std::abs(expected - actual) > fpRange) { totalNumberOfErrors++; } }); - compare_<1>(golden, test, [&totalNumberOfErrors](int32_t g, int32_t t) { + compare_<1>(golden, test, [&totalNumberOfErrors](int32_t expected, int32_t actual) { if (totalNumberOfErrors < gMaximumNumberOfErrorMessages) { - EXPECT_EQ(g, t); + EXPECT_EQ(expected, actual); } - if (g != t) { + if (expected != actual) { totalNumberOfErrors++; } }); - compare_<2>(golden, test, [&totalNumberOfErrors](uint8_t g, uint8_t t) { + compare_<2>(golden, test, [&totalNumberOfErrors](uint8_t expected, uint8_t actual) { if (totalNumberOfErrors < gMaximumNumberOfErrorMessages) { - EXPECT_NEAR(g, t, 1); + EXPECT_NEAR(expected, actual, 1); } - if (std::abs(g - t) > 1) { + if (std::abs(expected - actual) > 1) { totalNumberOfErrors++; } }); |