|
PH Logo
Logo intepreter modeled after UCB Logo.
|
00001 #define BOOST_TEST_MAIN 00002 #include <boost/test/unit_test.hpp> 00003 00004 #include <iostream> 00005 #include <string> 00006 #include <sstream> 00007 #include <algorithm> 00008 #include <iterator> 00009 00010 #include "Interpreter.h" 00011 #include "Console.h" 00012 #include "World.h" 00013 #include "Thing.h" 00014 00015 using namespace std; 00016 using namespace phlogo; 00017 00018 BOOST_AUTO_TEST_CASE( sentences ) 00019 { 00020 Interpreter itp(0); 00021 wList words = itp.sentence2words("hello"); 00022 BOOST_CHECK_EQUAL(words.size(), (unsigned int)1); 00023 BOOST_CHECK_EQUAL(words[0], "hello"); 00024 00025 words = itp.sentence2words("hello world"); 00026 BOOST_CHECK_EQUAL(words.size(), (unsigned int)2); 00027 BOOST_CHECK_EQUAL(words[0], "hello"); 00028 BOOST_CHECK_EQUAL(words[1], "world"); 00029 } 00030 00031 BOOST_AUTO_TEST_CASE( suite ) 00032 { 00033 StringConsole c; 00034 World w(&c); 00035 Interpreter itp(&w); 00036 itp.run(&w, "testsuite \"smoke"); 00037 BOOST_CHECK_EQUAL(w.getResult()->getWord(), "passed [30]"); 00038 }
1.7.4