require "navigator"
require "mock_acm"
require "test/unit"

class TestNavigator < Test::Unit::TestCase

  def setup()
    @rover = MockRover.new()
  end

  def test_forward()
    nv = Navigator.new(@rover)
    assert_nothing_raised(Exception){ nv.forward(80, 5) }
    assert_nothing_raised(Exception){ nv.forward(299, 5) }
    assert_nothing_raised(Exception){ nv.forward(5, 5) }
    assert_nothing_raised(Exception){ nv.forward(359, 5) }
  end

  def test_wait_for_current()
    nv = Navigator.new(@rover)
    #the mock acm will return values in a range of 230-274
    #so let's shoot for a current of 260, which means we want
    #a heading of 80
    assert(nv.wait_for_current(80), "wait for current failed")
    assert(nv.wait_for_current(200), "wait for current should have " <<
           "failed, but did not")
  end
end