THRIFT-5944: Corrected and expanded Ruby protocol benchmarks
diff --git a/test/rb/fixtures/structs.rb b/test/rb/fixtures/structs.rb
index 79f2997..d24e5d1 100644
--- a/test/rb/fixtures/structs.rb
+++ b/test/rb/fixtures/structs.rb
@@ -22,146 +22,198 @@
 module Fixtures
   module Structs
     class OneBool
-      include Thrift::Struct
-      attr_accessor :bool
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::BOOL, :name => 'bool'}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class OneByte
-      include Thrift::Struct
-      attr_accessor :byte
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::BYTE, :name => 'byte'}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class OneI16
-      include Thrift::Struct
-      attr_accessor :i16
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::I16, :name => 'i16'}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class OneI32
-      include Thrift::Struct
-      attr_accessor :i32
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::I32, :name => 'i32'}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class OneI64
-      include Thrift::Struct
-      attr_accessor :i64
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::I64, :name => 'i64'}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class OneDouble
-      include Thrift::Struct
-      attr_accessor :double
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::DOUBLE, :name => 'double'}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class OneString
-      include Thrift::Struct
-      attr_accessor :string
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::STRING, :name => 'string'}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class OneMap
-      include Thrift::Struct
-      attr_accessor :map
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::MAP, :name => 'map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRING}}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class NestedMap
-      include Thrift::Struct
-      attr_accessor :map
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         0 => {:type => Thrift::Types::MAP, :name => 'map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::MAP, :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::I32}}}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class OneList
-      include Thrift::Struct
-      attr_accessor :list
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::LIST, :name => 'list', :element => {:type => Thrift::Types::STRING}}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class NestedList
-      include Thrift::Struct
-      attr_accessor :list
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         0 => {:type => Thrift::Types::LIST, :name => 'list', :element => {:type => Thrift::Types::LIST, :element => { :type => Thrift::Types::I32 } } }
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class OneSet
-      include Thrift::Struct
-      attr_accessor :set
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::SET, :name => 'set', :element => {:type => Thrift::Types::STRING}}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     class NestedSet
-      include Thrift::Struct
-      attr_accessor :set
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::SET, :name => 'set', :element => {:type => Thrift::Types::SET, :element => { :type => Thrift::Types::STRING } }}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     # struct OneOfEach {
@@ -178,8 +230,8 @@
     #   11: binary base64,
     # }
     class OneOfEach
-      include Thrift::Struct
-      attr_accessor :im_true, :im_false, :a_bite, :integer16, :integer32, :integer64, :double_precision, :some_characters, :zomg_unicode, :what_who, :base64
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::BOOL, :name => 'im_true'},
         2 => {:type => Thrift::Types::BOOL, :name => 'im_false'},
@@ -191,20 +243,15 @@
         8 => {:type => Thrift::Types::STRING, :name => 'some_characters'},
         9 => {:type => Thrift::Types::STRING, :name => 'zomg_unicode'},
         10 => {:type => Thrift::Types::BOOL, :name => 'what_who'},
-        11 => {:type => Thrift::Types::STRING, :name => 'base64'}
+        11 => {:type => Thrift::Types::STRING, :name => 'base64', :binary => true}
       }
 
-      # Added for assert_equal
-      def ==(other)
-        [:im_true, :im_false, :a_bite, :integer16, :integer32, :integer64, :double_precision, :some_characters, :zomg_unicode, :what_who, :base64].each do |f|
-          var = "@#{f}"
-          return false if instance_variable_get(var) != other.instance_variable_get(var)
-        end
-        true
-      end
+      def struct_fields; FIELDS; end
 
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     # struct Nested1 {
@@ -215,8 +262,8 @@
     #   5: map<string, OneOfEach> str_map
     # }
     class Nested1
-      include Thrift::Struct
-      attr_accessor :a_list, :i32_map, :i64_map, :dbl_map, :str_map
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => OneOfEach}},
         2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => OneOfEach}},
@@ -225,8 +272,12 @@
         5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => OneOfEach}}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     # struct Nested2 {
@@ -237,8 +288,8 @@
     #   5: map<string, Nested1> str_map
     # }
     class Nested2
-      include Thrift::Struct
-      attr_accessor :a_list, :i32_map, :i64_map, :dbl_map, :str_map
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => Nested1}},
         2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => Nested1}},
@@ -247,8 +298,12 @@
         5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => Nested1}}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     # struct Nested3 {
@@ -259,8 +314,8 @@
     #   5: map<string, Nested2> str_map
     # }
     class Nested3
-      include Thrift::Struct
-      attr_accessor :a_list, :i32_map, :i64_map, :dbl_map, :str_map
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => Nested2}},
         2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => Nested2}},
@@ -269,8 +324,12 @@
         5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => Nested2}}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
 
     # struct Nested4 {
@@ -281,8 +340,8 @@
     #   5: map<string, Nested3> str_map
     # }
     class Nested4
-      include Thrift::Struct
-      attr_accessor :a_list, :i32_map, :i64_map, :dbl_map, :str_map
+      include Thrift::Struct, Thrift::Struct_Union
+
       FIELDS = {
         1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => Nested3}},
         2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => Nested3}},
@@ -291,8 +350,12 @@
         5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => Nested3}}
       }
 
+      def struct_fields; FIELDS; end
+
       def validate
       end
+
+      Thrift::Struct.generate_accessors self
     end
   end
 end