Class: BareTypes::U16

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



35
36
37
# File 'lib/generative_testing/monkey_patch.rb', line 35

def self.make(depth, names)
  BareTypes::U16.new
end

Instance Method Details

#create_inputObject



39
40
41
# File 'lib/generative_testing/monkey_patch.rb', line 39

def create_input
  rand(2 ** 16)
end

#decode(msg) ⇒ Object



317
318
319
# File 'lib/types.rb', line 317

def decode(msg)
  return msg.unpack("v")[0], msg[2..msg.size]
end

#encode(msg, buffer) ⇒ Object



313
314
315
# File 'lib/types.rb', line 313

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