You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by fo...@apache.org on 2020/02/23 19:45:52 UTC

[avro] branch master updated: AVRO-2756: Ruby should test all schema fingerprints defined in share/test/data/schema-tests.txt (#825)

This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new ebe9080  AVRO-2756: Ruby should test all schema fingerprints defined in share/test/data/schema-tests.txt (#825)
ebe9080 is described below

commit ebe9080060e5dd46328fcdd9a05f073944af54ce
Author: Kengo Seki <se...@apache.org>
AuthorDate: Mon Feb 24 04:45:44 2020 +0900

    AVRO-2756: Ruby should test all schema fingerprints defined in share/test/data/schema-tests.txt (#825)
---
 lang/ruby/test/case_finder.rb               | 7 ++++++-
 lang/ruby/test/test_schema_normalization.rb | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lang/ruby/test/case_finder.rb b/lang/ruby/test/case_finder.rb
index 3855127..9467cd5 100644
--- a/lang/ruby/test/case_finder.rb
+++ b/lang/ruby/test/case_finder.rb
@@ -50,7 +50,12 @@ class CaseFinder
       input = scan_input
       canonical = scan_canonical
       fingerprint = scan_fingerprint
-
+      if not fingerprint and @cases
+        fingerprint = @cases[-1].fingerprint
+      end
+      if fingerprint
+        fingerprint = fingerprint.to_i & 0xFFFF_FFFF_FFFF_FFFF
+      end
       Case.new(id, input, canonical, fingerprint)
     else
       @scanner.skip(/.*\n/)
diff --git a/lang/ruby/test/test_schema_normalization.rb b/lang/ruby/test/test_schema_normalization.rb
index 246d3ae..e5d7bfb 100644
--- a/lang/ruby/test/test_schema_normalization.rb
+++ b/lang/ruby/test/test_schema_normalization.rb
@@ -166,6 +166,7 @@ class TestSchemaNormalization < Test::Unit::TestCase
     CaseFinder.cases.each do |test_case|
       schema = Avro::Schema.parse(test_case.input)
       assert_equal test_case.canonical, Avro::SchemaNormalization.to_parsing_form(schema)
+      assert_equal test_case.fingerprint, schema.crc_64_avro_fingerprint
     end
   end
 end