You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by th...@apache.org on 2016/04/13 08:03:04 UTC
avro git commit: AVRO-1701: Fix for "warning: comparison between
'const enum testgen_r::ExampleEnum' and 'const enum testgen::ExampleEnum"
Repository: avro
Updated Branches:
refs/heads/master e98caa993 -> 683bc7135
AVRO-1701: Fix for "warning: comparison between 'const enum testgen_r::ExampleEnum' and 'const enum testgen::ExampleEnum"
Project: http://git-wip-us.apache.org/repos/asf/avro/repo
Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/683bc713
Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/683bc713
Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/683bc713
Branch: refs/heads/master
Commit: 683bc7135b6a69a8d524393f91ada8310a8f9f88
Parents: e98caa9
Author: Thiruvalluvan M. G <th...@verticloud.com>
Authored: Wed Apr 13 11:32:28 2016 +0530
Committer: Thiruvalluvan M. G <th...@verticloud.com>
Committed: Wed Apr 13 11:32:28 2016 +0530
----------------------------------------------------------------------
CHANGES.txt | 2 ++
lang/c++/test/AvrogencppTests.cc | 8 +++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/avro/blob/683bc713/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1399a94..ca8e207 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -17,6 +17,8 @@ Trunk (not yet released)
AVRO-1824: C++: Fix docs for building Avro C++. (William S. Fulton via blue)
+ AVRO-1701: Fix for "warning: comparison between 'const enum testgen_r::ExampleEnum' and 'const enum testgen::ExampleEnum'" (peter liu via thiru)
+
BUG FIXES
AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are
http://git-wip-us.apache.org/repos/asf/avro/blob/683bc713/lang/c++/test/AvrogencppTests.cc
----------------------------------------------------------------------
diff --git a/lang/c++/test/AvrogencppTests.cc b/lang/c++/test/AvrogencppTests.cc
index 2312676..26d0155 100644
--- a/lang/c++/test/AvrogencppTests.cc
+++ b/lang/c++/test/AvrogencppTests.cc
@@ -121,7 +121,13 @@ void checkRecord(const T1& r1, const T2& r2)
BOOST_CHECK_EQUAL(r1.bytes.size(), r2.bytes.size());
BOOST_CHECK_EQUAL_COLLECTIONS(r1.bytes.begin(), r1.bytes.end(),
r2.bytes.begin(), r2.bytes.end());
- BOOST_CHECK_EQUAL(r1.myenum, r2.myenum);
+ /**
+ * Usually, comparing two different enums is not reliable. But here it fine because we
+ * know the generated code and are merely checking if Avro did the right job.
+ * Also, converting enum into unsigned int is not always safe. There are cases there could be
+ * truncation. Again, we have a controlled situation and it is safe here.
+ */
+ BOOST_CHECK_EQUAL(static_cast<unsigned int>(r1.myenum), static_cast<unsigned int>(r2.myenum));
}
void checkDefaultValues(const testgen_r::RootRecord& r)