diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-08-22 22:40:46 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-08-22 22:40:46 (GMT) |
commit | 10e6e1db531a682f852b488ba8bf4cbb2f984d88 (patch) | |
tree | 1f4b526103d1e6350a0ec09f40ae426344540dee /test/src | |
parent | 9509b795c7493d7b351dc25855a6a82cd392deb1 (diff) | |
download | uscxml-10e6e1db531a682f852b488ba8bf4cbb2f984d88.zip uscxml-10e6e1db531a682f852b488ba8bf4cbb2f984d88.tar.gz uscxml-10e6e1db531a682f852b488ba8bf4cbb2f984d88.tar.bz2 |
Spring cleaning of tests
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/test-apache-commons.cpp | 128 | ||||
-rw-r--r-- | test/src/test-arabica-namespaces.cpp | 7 | ||||
-rw-r--r-- | test/src/test-arabica-xpath.cpp | 4 | ||||
-rw-r--r-- | test/src/test-cmdline-parsing.cpp | 2 | ||||
-rw-r--r-- | test/src/test-curl-multi-api.cpp | 404 | ||||
-rw-r--r-- | test/src/test-ecmascript-v8.cpp.old | 24 | ||||
-rw-r--r-- | test/src/test-execution.cpp.old | 16 | ||||
-rw-r--r-- | test/src/test-initial-config.cpp | 36 | ||||
-rw-r--r-- | test/src/test-instant-messaging.cpp | 2 | ||||
-rw-r--r-- | test/src/test-osg.cpp | 26 | ||||
-rw-r--r-- | test/src/test-prolog-swi.cpp.old | 93 | ||||
-rw-r--r-- | test/src/test-w3c.cpp | 9 |
12 files changed, 9 insertions, 742 deletions
diff --git a/test/src/test-apache-commons.cpp b/test/src/test-apache-commons.cpp deleted file mode 100644 index 9ac4442..0000000 --- a/test/src/test-apache-commons.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include "uscxml/Interpreter.h" -#include <glog/logging.h> - -using namespace uscxml; -using namespace Arabica::DOM; -using namespace Arabica::XPath; - -static std::string path; - -bool testEvents1() { - LOG(INFO) << "---- testEvent1 "; - Interpreter* interpreter = Interpreter::fromURI(path + "/eventdata-01.xml"); - interpreter->start(); - interpreter->waitForStabilization(); - assert(interpreter->getConfiguration().size() == 1); - assert(Interpreter::isMember(interpreter->getState("state1"), interpreter->getConfiguration())); - - Event eventFoo; - eventFoo.name = "event.foo"; - eventFoo.atom = "3"; - interpreter->receive(eventFoo); - interpreter->waitForStabilization(); - assert(interpreter->getConfiguration().size() == 1); - assert(Interpreter::isMember(interpreter->getState("state3"), interpreter->getConfiguration())); - - Event eventBar; - eventBar.name = "event.bar"; - eventBar.atom = "6"; - interpreter->receive(eventBar); - interpreter->waitForStabilization(); - assert(interpreter->getConfiguration().size() == 1); - assert(Interpreter::isMember(interpreter->getState("state6"), interpreter->getConfiguration())); - - Event eventBaz; - eventBaz.name = "event.baz"; - eventBaz.atom = "7"; - interpreter->receive(eventBaz); - - delete interpreter; - return true; -} - -bool testEvents2() { - LOG(INFO) << "---- testEvent2 "; - Interpreter* interpreter = Interpreter::fromURI(path + "/eventdata-02.xml"); - interpreter->start(); - interpreter->waitForStabilization(); - assert(interpreter->getConfiguration().size() == 1); - assert(Interpreter::isMember(interpreter->getState("state0"), interpreter->getConfiguration())); - - Event eventConnAlert; - eventConnAlert.name = "connection.alerting"; - eventConnAlert.atom = "'line2'"; - interpreter->receive(eventConnAlert); - interpreter->waitForStabilization(); - assert(interpreter->getConfiguration().size() == 1); - assert(Interpreter::isMember(interpreter->getState("state2"), interpreter->getConfiguration())); - - Event eventConnAlert2; - eventConnAlert2.name = "connection.alerting"; - eventConnAlert2.compound["line"] = Data(std::string("4")); - interpreter->receive(eventConnAlert2); - - delete interpreter; - return true; -} - -//bool testEvents3() { -// LOG(INFO) << "---- testEvent3 "; -// Interpreter* Interpreter = new Interpreter(path + "/eventdata-03.xml"); -// interpreter->start(); -// interpreter->waitForStabilization(); -// Thread::sleepMs(200); -// assert(interpreter->getConfiguration().size() == 1); -// assert(Interpreter::isMember(interpreter->getState("state0"), interpreter->getConfiguration())); -// -// Event eventConnAlert; -// eventConnAlert.name = "connection.alerting"; -// eventConnAlert.atom = "'line2'"; -// interpreter->receive(eventConnAlert); -// Thread::sleepMs(200); -// assert(interpreter->getConfiguration().size() == 1); -// assert(Interpreter::isMember(interpreter->getState("state2"), interpreter->getConfiguration())); -// -// Event eventConnAlert2; -// eventConnAlert2.name = "connection.alerting"; -// eventConnAlert2.compound["line"] = Data(std::string("4")); -// interpreter->receive(eventConnAlert2); -// Thread::sleepMs(200); -// assert(interpreter->getConfiguration().size() == 1); -// assert(Interpreter::isMember(interpreter->getState("state4"), interpreter->getConfiguration())); -// -// delete Interpreter; -// return true; -//} - - -int main(int argc, char** argv) { - if (argc != 2) { - std::cerr << "Expected path to scxml file from apache commons distribution" << std::endl; - exit(EXIT_FAILURE); - } - - path = "file://"; - path += argv[1]; - - if (!testEvents1()) - return EXIT_FAILURE; - if (!testEvents2()) - return EXIT_FAILURE; -// if (!testEvents3()) -// return EXIT_FAILURE; - -// -// Interpreter* scxmlInterpreter = new Interpreter(path + "/tie-breaker-01.xml"); -// SCXMLRunner* scxmlRun = new SCXMLRunner(scxmlInterpreter); -// scxmlRun->start(); -// -// Thread::sleepMs(100); -// assert(Interpreter::isMember(scxmlinterpreter->getState("ten"), scxmlinterpreter->getConfiguration())); -// -// boost::shared_ptr<Event> event = boost::shared_ptr<Event>(new Event()); -// event->name = "ten.done"; -// scxmlinterpreter->receive(event); -// scxmlRun->join(); -// scxmlinterpreter->receive(event); - -}
\ No newline at end of file diff --git a/test/src/test-arabica-namespaces.cpp b/test/src/test-arabica-namespaces.cpp index 32feacd..3214d9f 100644 --- a/test/src/test-arabica-namespaces.cpp +++ b/test/src/test-arabica-namespaces.cpp @@ -33,7 +33,6 @@ assert(InterpreterImpl::filterChildElements(origNS.xmlNSPrefix + "baz", origDoc. Test DOM manipulations and document cloning with different namespace scenarios */ -static std::string testPath; static Arabica::XPath::XPath<std::string> _xpath; std::pair<Document<std::string>, NameSpaceInfo> parse(const std::string xmlString) { @@ -159,12 +158,6 @@ static void validateRootFooBarBaz(std::pair<Document<std::string>, NameSpaceInfo int main(int argc, char** argv) { - if (argc < 2) { - std::cerr << "Expected path to the tests as first argument"; - exit(EXIT_FAILURE); - } - testPath = argv[1]; - // No namespaces at all { std::stringstream xmlSS; diff --git a/test/src/test-arabica-xpath.cpp b/test/src/test-arabica-xpath.cpp index ce389fa..998f4aa 100644 --- a/test/src/test-arabica-xpath.cpp +++ b/test/src/test-arabica-xpath.cpp @@ -194,7 +194,7 @@ int main(int argc, char** argv) { assert(SA::construct_from_utf8("root") == result.asString()); } // testLocalNameFn1 - { + if (0) { using namespace Arabica::XPath; Arabica::DOM::DocumentFragment<std::string> frag = document_.createDocumentFragment(); frag.appendChild(document_.createElement("foo")); @@ -205,7 +205,7 @@ int main(int argc, char** argv) { svr.setVariable("fruit", ns); parser.setVariableResolver(svr); - XPathValue<string_type, string_adaptor> result = parser.evaluate(SA::construct_from_utf8("local-name($fruit/foo) = 'foo'"), document_); + XPathValue<string_type, string_adaptor> result = parser.evaluate(SA::construct_from_utf8("local-name($fruit/foo) == 'foo'"), document_); std::cout << result.asBool() << std::endl; } diff --git a/test/src/test-cmdline-parsing.cpp b/test/src/test-cmdline-parsing.cpp index 6fa0c57..edf90bc 100644 --- a/test/src/test-cmdline-parsing.cpp +++ b/test/src/test-cmdline-parsing.cpp @@ -8,7 +8,7 @@ int main(int argc, char** argv) { using namespace uscxml; if (true) { - int testArgc = 11; + int testArgc = 10; const char* testArgv[] = { "test-cmdline-parsing", "--verbose", diff --git a/test/src/test-curl-multi-api.cpp b/test/src/test-curl-multi-api.cpp deleted file mode 100644 index 67735d2..0000000 --- a/test/src/test-curl-multi-api.cpp +++ /dev/null @@ -1,404 +0,0 @@ -#include <curl/curl.h> -#include <glog/logging.h> -#include <string> -#include <iostream> -#include <sstream> -#include <map> -#include <set> -#include <boost/shared_ptr.hpp> -#include <boost/enable_shared_from_this.hpp> - -#include "uscxml/concurrency/tinythread.h" - -// use arabica URL parser -#include <io/uri.hpp> - -class URL; - -class URLMonitor { -public: - virtual void downloadStarted(const URL& url) {}; - virtual void downloadCompleted(const URL& url) {}; - virtual void downloadFailed(const URL& url, int errorCode) {}; - virtual void headerChunkReceived(const URL& url, const std::string& headerChunk) {}; - virtual void contentChunkReceived(const URL& url, const std::string& contentChunk) {}; -}; - -class URLImpl : public boost::enable_shared_from_this<URLImpl> { -public: - URLImpl(const std::string& url) : _handle(NULL), _uri(url), _isDownloaded(false) { - _handle = curl_easy_init(); - if (_handle != NULL) { - CURLcode curlError; - curlError = curl_easy_setopt(_handle, CURLOPT_URL, _uri.as_string().c_str()); - if (curlError != CURLE_OK) - LOG(ERROR) << "Cannot set url to " << _uri.as_string() << ": " << curl_easy_strerror(curlError); - - curlError = curl_easy_setopt(_handle, CURLOPT_WRITEDATA, this); - if (curlError != CURLE_OK) - LOG(ERROR) << "Cannot register this as write userdata: " << curl_easy_strerror(curlError); - - curlError = curl_easy_setopt(_handle, CURLOPT_WRITEFUNCTION, URLImpl::writeHandler); - if (curlError != CURLE_OK) - LOG(ERROR) << "Cannot set write callback: " << curl_easy_strerror(curlError); - - curlError = curl_easy_setopt(_handle, CURLOPT_HEADERFUNCTION, URLImpl::headerHandler); - if (curlError != CURLE_OK) - LOG(ERROR) << "Cannot request header from curl: " << curl_easy_strerror(curlError); - - curlError = curl_easy_setopt(_handle, CURLOPT_HEADERDATA, this); - if (curlError != CURLE_OK) - LOG(ERROR) << "Cannot register this as header userdata: " << curl_easy_strerror(curlError); - } else { - LOG(ERROR) << "curl_easy_init returned NULL, this is bad!"; - } - } - - ~URLImpl() { - if (_handle != NULL) - curl_easy_cleanup(_handle); - } - - static size_t writeHandler(void *ptr, size_t size, size_t nmemb, void *userdata) { - URLImpl* url = (URLImpl*)userdata; - url->_content.write((char*)ptr, size * nmemb); - return size * nmemb; - } - - static size_t headerHandler(void *ptr, size_t size, size_t nmemb, void *userdata) { - URLImpl* url = (URLImpl*)userdata; - url->_header.write((char*)ptr, size * nmemb); - return size * nmemb; - } - - void addMonitor(URLMonitor* monitor) { - _monitors.insert(monitor); - } - void removeMonitor(URLMonitor* monitor) { - _monitors.erase(monitor); - } - - const bool isAbsolute() const { - return _uri.is_absolute(); - } - const std::string scheme() const { - return _uri.scheme(); - } - const std::string host() const { - return _uri.host(); - } - const std::string port() const { - return _uri.port(); - } - const std::string path() const { - return _uri.path(); - } - const std::string asString() const { - return _uri.as_string(); - } - - void downloadStarted() { - std::cout << "Starting download of " << asString() << std::endl; - _content.str(""); - _content.clear(); - _header.str(""); - _header.clear(); - monIter_t monIter = _monitors.begin(); - while(monIter != _monitors.end()) { -// (*monIter)->downloadStarted(URL(shared_from_this())); - monIter++; - } - } - - void downloadCompleted() { - std::cout << "Finished loading " << asString() << " with " << _content.str().size() << " bytes" << std::endl; - _isDownloaded = true; - } - - void downloadFailed(int errorCode) { - std::cout << "FAILED!" << strerror(errorCode) << std::endl; - } - - std::string getHeader(bool forceReload = false) { - return _header.str(); - } - - std::string getContent(bool forceReload = false) { - return _content.str(); - } - - std::stringstream _content; - std::stringstream _header; - CURL* _handle; - Arabica::io::URI _uri; - bool _isDownloaded; - - std::set<URLMonitor*> _monitors; - typedef std::set<URLMonitor*>::iterator monIter_t; -}; - -class URL { -public: - URL() : _impl() {} - URL(const std::string url) : _impl(new URLImpl(url)) {} - URL(boost::shared_ptr<URLImpl> const impl) : _impl(impl) { } - URL(const URL& other) : _impl(other._impl) { } - virtual ~URL() {}; - - operator bool() const { - return _impl; - } - bool operator< (const URL& other) const { - return _impl < other._impl; - } - bool operator==(const URL& other) const { - return _impl == other._impl; - } - bool operator!=(const URL& other) const { - return _impl != other._impl; - } - URL& operator= (const URL& other) { - _impl = other._impl; - return *this; - } - - std::string getHeader() { - return _impl->getHeader(); - } - std::string getContent() { - return _impl->getContent(); - } - - const bool toAbsoluteCwd() { - return _impl->toAbsoluteCwd(); - } - const bool toAbsolute(const std::string& baseUrl) { - return _impl->toAbsolute(baseUrl); - } - const bool toAbsolute(const URL& baseUrl) { - return _impl->toAbsolute(baseUrl.asString()); - } - const std::string asLocalFile(const std::string& suffix, bool reload = false) { - return _impl->asLocalFile(suffix, reload); - } - - void addMonitor(URLMonitor* monitor) { - _impl->addMonitor(monitor); - } - void removeMonitor(URLMonitor* monitor) { - _impl->removeMonitor(monitor); - } - - const bool isAbsolute() const { - return _impl->isAbsolute(); - } - const std::string scheme() const { - return _impl->scheme(); - } - const std::string host() const { - return _impl->host(); - } - const std::string port() const { - return _impl->port(); - } - const std::string path() const { - return _impl->path(); - } - const std::string asString() const { - return _impl->asString(); - } - - friend class URLFetcher; - friend std::ostream & operator<<(std::ostream &stream, const URL& p); - -protected: - void downloadStarted() { - return _impl->downloadStarted(); - } - void downloadCompleted() { - return _impl->downloadCompleted(); - } - void downloadFailed(int errorCode) { - return _impl->downloadFailed(errorCode); - } - - boost::shared_ptr<URLImpl> _impl; -}; - -class URLFetcher { -public: - URLFetcher() { - _multiHandle = curl_multi_init(); - start(); - } - - ~URLFetcher() { - curl_multi_cleanup(_multiHandle); - stop(); - } - - void fetchURL(URL& url) { - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - url.downloadStarted(); - _handlesToURLs[url._impl->_handle] = url; - curl_multi_add_handle(_multiHandle, url._impl->_handle); - _condVar.notify_all(); - } - - void breakURL(URL& url) { - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - if (_handlesToURLs.find(url._impl->_handle) != _handlesToURLs.end()) { - url.downloadFailed(0); - curl_multi_remove_handle(_multiHandle, url._impl->_handle); - _handlesToURLs.erase(url._impl->_handle); - } - } - - void start() { - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - if (!_isStarted) { - _isStarted = true; - _thread = new tthread::thread(URLFetcher::run, this); - } - } - - void stop() { - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - if (_isStarted) { - _isStarted = false; - _thread->join(); - delete _thread; - } - } - - static void run(void* instance) { - URLFetcher* THIS = (URLFetcher*)instance; - THIS->_mutex.lock(); - while(THIS->_isStarted) { - if(THIS->_handlesToURLs.size() > 0) { - THIS->_mutex.unlock(); - THIS->perform(); - THIS->_mutex.lock(); - } - THIS->_condVar.wait(THIS->_mutex); - } - THIS->_mutex.unlock(); - } - - void perform() { - - CURLMsg *msg; /* for picking up messages with the transfer status */ - int msgsLeft; /* how many messages are left */ - int stillRunning; - - { - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - curl_multi_perform(_multiHandle, &stillRunning); - } - - do { - struct timeval timeout; - int rc; /* select() return code */ - - fd_set fdread, fdwrite, fdexcep; - FD_ZERO(&fdread); - FD_ZERO(&fdwrite); - FD_ZERO(&fdexcep); - - int maxfd = -1; - long curlTimeOut = -1; - - /* set a suitable timeout to play around with */ - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - { - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - curl_multi_timeout(_multiHandle, &curlTimeOut); - } - - if(curlTimeOut >= 0) { - timeout.tv_sec = curlTimeOut / 1000; - if(timeout.tv_sec > 1) - timeout.tv_sec = 1; - else - timeout.tv_usec = (curlTimeOut % 1000) * 1000; - } - - /* get file descriptors from the transfers */ - { - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - curl_multi_fdset(_multiHandle, &fdread, &fdwrite, &fdexcep, &maxfd); - } - - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - - switch(rc) { - case -1: - /* select error */ - break; - case 0: /* timeout */ - default: { /* action */ - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - curl_multi_perform(_multiHandle, &stillRunning); - } - break; - } - - { - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - while ((msg = curl_multi_info_read(_multiHandle, &msgsLeft))) { - if (msg->msg == CURLMSG_DONE) { - _handlesToURLs[msg->easy_handle].downloadCompleted(); - curl_multi_remove_handle(_multiHandle, msg->easy_handle); - _handlesToURLs.erase(msg->easy_handle); - } else { - switch (msg->data.result) { - case CURLM_OK: - break; - case CURLM_BAD_HANDLE: - case CURLM_BAD_EASY_HANDLE: - case CURLM_OUT_OF_MEMORY: - case CURLM_INTERNAL_ERROR: - case CURLM_BAD_SOCKET: - case CURLM_UNKNOWN_OPTION: - case CURLM_LAST: - _handlesToURLs[msg->easy_handle].downloadFailed(msg->data.result); - curl_multi_remove_handle(_multiHandle, msg->easy_handle); - _handlesToURLs.erase(msg->easy_handle); - default: - break; - } - } - } - } - } while(stillRunning && _isStarted); - - } - - tthread::condition_variable _condVar; - tthread::thread* _thread; - tthread::recursive_mutex _mutex; - bool _isStarted; - - std::map<CURL*, URL> _handlesToURLs; - CURLM* _multiHandle; -}; - - -int main(int argc, char** argv) { - URLFetcher fetcher; - URL heise("http://www.heise.de"); - URL localFile("file:///Users/sradomski/Desktop/scxml.xsd"); - URL slashdot("http://slashdot.org"); - URL asdf("daf://localhost:234"); - URL bahn("http://www.bahn.de"); - - fetcher.fetchURL(heise); - fetcher.fetchURL(localFile); - fetcher.fetchURL(asdf); - fetcher.fetchURL(slashdot); - fetcher.fetchURL(bahn); - - while(1) {} -}
\ No newline at end of file diff --git a/test/src/test-ecmascript-v8.cpp.old b/test/src/test-ecmascript-v8.cpp.old deleted file mode 100644 index 9ce39d9..0000000 --- a/test/src/test-ecmascript-v8.cpp.old +++ /dev/null @@ -1,24 +0,0 @@ -#include "uscxml/Interpreter.h" -#include "uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h" - -int main(int argc, char** argv) { - if (argc != 2) { - std::cerr << "Expected path to test-ecmascript.scxml" << std::endl; - exit(EXIT_FAILURE); - } - - using namespace uscxml; - using namespace Arabica::DOM; - using namespace Arabica::XPath; - - Interpreter* scxml = Interpreter::fromURI(argv[1]); - scxml->start(); - scxml->waitForStabilization(); - - Event event1; - event1.name = "event1"; - scxml->receive(event1); - scxml->join(); - tthread::this_thread::sleep_for(tthread::chrono::milliseconds(500)); - -}
\ No newline at end of file diff --git a/test/src/test-execution.cpp.old b/test/src/test-execution.cpp.old deleted file mode 100644 index 272ce41..0000000 --- a/test/src/test-execution.cpp.old +++ /dev/null @@ -1,16 +0,0 @@ -#include "uscxml/Interpreter.h" - -int main(int argc, char** argv) { - if (argc != 2) { - std::cerr << "Expected path to test-execution.scxml" << std::endl; - exit(EXIT_FAILURE); - } - - using namespace uscxml; - using namespace Arabica::DOM; - using namespace Arabica::XPath; - - Interpreter* interpreter = Interpreter::fromURI(argv[1]); - interpreter->dump(); - interpreter->interpret(); -}
\ No newline at end of file diff --git a/test/src/test-initial-config.cpp b/test/src/test-initial-config.cpp deleted file mode 100644 index dcba84d..0000000 --- a/test/src/test-initial-config.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "uscxml/Message.h" -#include "uscxml/Interpreter.h" -#include <assert.h> -#include <boost/algorithm/string.hpp> -#include <iostream> - -using namespace uscxml; -using namespace boost; - - -int main(int argc, char** argv) { -#ifdef _WIN32 - WSADATA wsaData; - WSAStartup(MAKEWORD(2, 2), &wsaData); -#endif - - if (argc != 2) { - std::cerr << "Expected path to test-initial-config.scxml" << std::endl; - exit(EXIT_FAILURE); - } - - std::string test = argv[1]; - - { - Interpreter interpreter = Interpreter::fromURI(test); - std::vector<std::string> states; - states.push_back("finish_shortcut"); - states.push_back("ADMINISTRATIVE_NON-HR-MANAGEMENT"); - states.push_back("HR-MANAGER_MANAGE-HR"); - states.push_back("SYSTEM_1.1_BEGIN"); - states.push_back("COORDINATOR_1"); - interpreter.setConfiguration(states); - interpreter.interpret(); - } - -}
\ No newline at end of file diff --git a/test/src/test-instant-messaging.cpp b/test/src/test-instant-messaging.cpp index a63df34..4375e94 100644 --- a/test/src/test-instant-messaging.cpp +++ b/test/src/test-instant-messaging.cpp @@ -268,7 +268,7 @@ int main(int argc, char *argv[]) { account = purple_account_new("uscxml@localhost", "prpl-jabber"); /* Get the password for the account */ - purple_account_set_password(account, "password", NULL, NULL); + purple_account_set_password(account, "password"); /* It's necessary to enable the account first. */ purple_account_set_enabled(account, UI_ID, TRUE); diff --git a/test/src/test-osg.cpp b/test/src/test-osg.cpp deleted file mode 100644 index a3fcdc6..0000000 --- a/test/src/test-osg.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include <osgDB/ReadFile> -#include <osgViewer/Viewer> - -#include "uscxml/concurrency/tinythread.h" - -tthread::thread* thread; -osgViewer::Viewer viewer; - -void run(void* instance) { - osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile("/Users/sradomski/Documents/TK/Projects/SmartVortex/Code/FE-Design/data/sv_processed/HARD_MP_VAL_000.wrl.osgb"); - viewer.setSceneData(loadedModel.get()); - -// viewer.startThreading(); - viewer.run(); -} - - -int main(int argc, char** argv) { - viewer.setThreadingModel(osgViewer::ViewerBase::SingleThreaded); - viewer.realize(); - thread = new tthread::thread(run, NULL); - while(true) { - tthread::this_thread::sleep_for(tthread::chrono::microseconds(1000)); -// viewer.eventTraversal(); - } -}
\ No newline at end of file diff --git a/test/src/test-prolog-swi.cpp.old b/test/src/test-prolog-swi.cpp.old deleted file mode 100644 index 9e44f12..0000000 --- a/test/src/test-prolog-swi.cpp.old +++ /dev/null @@ -1,93 +0,0 @@ -#include <iostream> -#include <SWI-Prolog.h> -#include <SWI-cpp.h> -#include "uscxml/config.h" - -using namespace std; - -int main(void) { - const char* swibin = getenv("SWI_BINARY"); - if (swibin == NULL) - swibin = SWI_BINARY; - - static char * av[] = { - (char*)swibin, -// "--quiet", -// "-s", -// "/Users/sradomski/Documents/TK/Code/pl-devel/demo/likes.pl", - NULL - }; - if( ! PL_initialise(1,av)) { - cout<<"error initializing"<<endl; - PL_halt(1); - } else { - cout<<"success initializing!"<<endl; - } - -// unsigned long fid = PL_open_foreign_frame(); - - int rval; - PlFrame frame; - rval = PlCall("user", "load_files", PlTermv("/Users/sradomski/Documents/TK/Code/pl-devel/demo/likes.pl")); - -// PlCompound compound("likes(sam, X)"); - PlCompound compound("listing"); - PlTermv termv(compound.arity()); -// termv[0] = PlTerm(); - for (int i = 0; i < compound.arity(); i++) { - termv[i] = compound[i + 1]; - } - - PlQuery q(compound.name(), termv); - bool solutionExists = false; - while( q.next_solution() ) { - solutionExists = true; - for (int i = 0; i < compound.arity(); i++) { - switch (compound[i + 1].type()) { - case PL_VARIABLE: - std::cout << (char *)termv[i] << ", "; - break; - case PL_FLOAT: - std::cout << (double)termv[i] << ", "; - break; - case PL_ATOM: - std::cout << (PlAtom)termv[i] << ", "; - break; - case PL_STRING: - std::cout << (char *)termv[i] << ", "; - break; - case PL_TERM: - std::cout << (char *)termv[i] << ", "; - break; - default: - ; - } - } - std::cout << std::endl; - } - - -// PlQuery query2(compound.name(), PlTermv(compound)); -// if (query2.next_solution() > 0) { -// std::cout << "Yes!" << std::endl; -// } else { -// std::cout << "No!" << std::endl; -// } - -// std::cout << compound.name() << std::endl; -// PlTermv filename("/Users/sradomski/Documents/TK/Code/pl-devel/demo/likes.pl"); -// PlQuery loadFiles("system", "load_files", filename); - -// predicate_t loadFiles = PL_predicate("load_files",1,"system"); -// term_t h0 = PL_new_term_refs(1); - -// int rval; -// const char * expression = "/Users/sradomski/Documents/TK/Code/pl-devel/demo/likes.pl"; -// PL_put_atom_chars(h0,expression); -// rval = PL_call_predicate(NULL, PL_Q_NORMAL, loadFiles, h0); - -// PL_halt( rval ? 0 : 1 ); - -// PL_close_foreign_frame(fid); - return 0; -} diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp index 4bd27b1..31ab9b9 100644 --- a/test/src/test-w3c.cpp +++ b/test/src/test-w3c.cpp @@ -95,6 +95,8 @@ void customTerminate() { abort(); } +int retCode = EXIT_FAILURE; + class W3CStatusMonitor : public uscxml::InterpreterMonitor { void beforeTakingTransition(uscxml::Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) { @@ -147,17 +149,16 @@ class W3CStatusMonitor : public uscxml::InterpreterMonitor { std::cout << ATTR_CAST(config[0], "id") << std::endl; if (boost::starts_with(ATTR_CAST(config[0], "id"), "active:{pass")) { std::cout << "TEST SUCCEEDED" << std::endl; - exit(EXIT_SUCCESS); + retCode = EXIT_SUCCESS; } } else { if (boost::iequals(ATTR_CAST(config[0], "id"), "pass")) { std::cout << "TEST SUCCEEDED" << std::endl; - exit(EXIT_SUCCESS); + retCode = EXIT_SUCCESS; } } } std::cout << "TEST FAILED" << std::endl; - exit(EXIT_FAILURE); } Arabica::XPath::NodeSet<std::string> exitingStates; @@ -224,5 +225,5 @@ int main(int argc, char** argv) { while(interpreter.runOnMainThread(25)); } - return EXIT_SUCCESS; + return retCode; }
\ No newline at end of file |