diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-04-12 04:16:27 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-04-12 04:16:27 +0400 |
commit | 0e9b5fd9d0b7458a938a02fd73f23b07b462a3ba (patch) | |
tree | 89d55526b81cd54ed49f1e9ad07787f9594cc8c0 /mert/BleuScorerTest.cpp | |
parent | 366d427ce68e1cd922c0629667dc3ee05e8183c1 (diff) |
Add const to return values of overloaded operators.
* This commit prevents developers from doing mistakes like:
Point p1, p2, p4;
if (p1 + p2 = p4) { // Bang! We actually wanted to compare
// the result of two points: (p1 + p2 == p4).
// do something.
}
See, e.g., http://www.gotw.ca/gotw/006.htm for details.
* Add more test cases according to this change.
* Move a helper function to compare floating point numbers
to Util.h.
Diffstat (limited to 'mert/BleuScorerTest.cpp')
-rw-r--r-- | mert/BleuScorerTest.cpp | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/mert/BleuScorerTest.cpp b/mert/BleuScorerTest.cpp index a40949d78..6b01da0ce 100644 --- a/mert/BleuScorerTest.cpp +++ b/mert/BleuScorerTest.cpp @@ -111,19 +111,6 @@ void SetUpReferences(BleuScorer& scorer) { } } -const float kEPS = 0.0001f; - -template <typename T> -bool IsAlmostEqual(T expected, T actual) { - if (abs(expected - actual) < kEPS) { - return true; - } else { - cerr << "Fail: expected = " << expected - << " (actual = " << actual << ")" << endl; - return false; - } -} - } // namespace BOOST_AUTO_TEST_CASE(bleu_reference_type) { |