Class: Testrus::Input

Inherits:
Object
  • Object
show all
Defined in:
lib/testrus/input.rb,
lib/testrus/input/file.rb

Defined Under Namespace

Classes: File

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Input

Public: Initializes a new Input. An Input is the standard object from an Input source to the Tester.

options - The Hash specifying the input options:

:input  - The String input matching the expected output.
:output - The String expected output from the program for the
          associated input.
:name   - The String name of the input, this is usually the
          number of the test relative to the others, and should be
          provided by the source.


16
17
18
# File 'lib/testrus/input.rb', line 16

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/testrus/input.rb', line 3

def options
  @options
end

Instance Method Details

#inputObject

Public: Returns the formatted input.



26
27
28
# File 'lib/testrus/input.rb', line 26

def input
  @options[:input].strip
end

#nameObject

Public: Returns the name of the input/output pair.



21
22
23
# File 'lib/testrus/input.rb', line 21

def name
  @options[:name].strip
end

#outputObject Also known as: expected_output

Public: Returns the formatted expected output.



31
32
33
# File 'lib/testrus/input.rb', line 31

def output
  @options[:output].strip
end