Sha256: 26fc80874108d6a2c162b3ae5b7ab14c23c5d5ae2ae39607571035eaeea3a8f9

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

require_relative "../lib/logicle.rb"

module TestHelper
  def node(type, id=1)
    Logicle::Node.new(id, type)
  end

  def digraph
    @digraph ||= Logicle::Digraph.new
  end

  def assert_node_state_for_inputs(value, target_node, *inputs)
    target_node.clear_inputs
    target_node.append_inputs(*inputs)
    assert_equal(value, target_node.state)
  end

  def tgf_reader(input=tgf_content)
    @tgf_reader ||= Logicle::TgfReader.new(input)
  end

  def tgf_content
    @tgf_content ||= <<-TGF.gsub(/^\s+/, "")
      1 NOT
      2 AND
      3 OR
      4 SWITCH
      5 SWITCH
      6 SWITCH
      7 BULB
      #
      4 1
      5 2
      6 2
      2 3
      1 3
      3 7
      TGF
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logicle-0.1.1 test/test_helper.rb
logicle-0.1.0 test/test_helper.rb