require 'test/unit' require 'myagent' require 'wnbot' class TestWN < Test::Unit::TestCase def set_up end def test_syns @wn = MyAgent.new expected = /strange/ actual = @wn.send("syns: curious") assert_match(expected, actual) actual = @wn.send("what are the synonyms of curious") assert_match(expected, actual) end def test_over @wn = MyAgent.new expected = /synaesthesia/ actual = @wn.send("over: synaesthesia") assert_match(expected, actual) actual = @wn.send("!dict synaesthesia") assert_match(expected, actual) actual = @wn.send("what does synaesthesia mean?") assert_match(expected, actual) end def test_help @wn = WNBot.new expected = /Overview of Senses/ actual, = @wn.send("wn help") assert_match(expected, actual) actual, = @wn.send("wnbot: wn help me please!") assert_match(expected, actual) end def test_name @wn = WNBot.new expected = /wnbot or wnagent/ actual = @wn.send("what is your name?") assert_match(expected, actual) end def test_loud_soft @wn = WNBot.new expected = /threshhold.*?1.*?score_mod.*?0/i actual = @wn.send("wnbot what is your threshold?") assert_match(expected, actual) expected = /threshhold.*?2.*?score_mod.*?-1/i actual = @wn.send("wnbot quiet") assert_match(expected, actual) expected = /threshhold.*?1.*?score_mod.*?0/i actual = @wn.send("wnbot loud") assert_match(expected, actual) expected = /threshhold.*?0.*?score_mod.*?1/i actual = @wn.send("wnbot loud") assert_match(expected, actual) end end