Class: BareTypes::F64

Inherits:
BarePrimitive show all
Defined in:
lib/types.rb,
lib/generative_testing/monkey_patch.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BarePrimitive

#==, #finalize_references, #to_schema

Methods inherited from BaseType

#cycle_search, #initialize

Constructor Details

This class inherits a constructor from BareTypes::BaseType

Class Method Details

.make(depth, names) ⇒ Object



126
127
128
# File 'lib/generative_testing/monkey_patch.rb', line 126

def self.make(depth, names)
  self.new
end

Instance Method Details

#create_inputObject



130
131
132
133
134
135
136
137
138
139
140
# File 'lib/generative_testing/monkey_patch.rb', line 130

def create_input
  float = nil
  loop do
    input = [rand(266), rand(266), rand(266), rand(266), rand(266), rand(266), rand(266), rand(266)]
    float = input.pack("cccccccc").unpack('E')
    if float[0] == float[0] && !float[0].nan?
      break
    end
  end
  float[0]
end

#decode(msg) ⇒ Object



194
195
196
# File 'lib/types.rb', line 194

def decode(msg)
  return msg.unpack("E")[0], msg[8..msg.size]
end

#encode(msg, buffer) ⇒ Object



190
191
192
# File 'lib/types.rb', line 190

def encode(msg, buffer)
  buffer << [msg].pack("E")
end