diff options
author | Stefan Radomski <sradomski@mintwerk.de> | 2016-02-24 10:50:32 (GMT) |
---|---|---|
committer | Stefan Radomski <sradomski@mintwerk.de> | 2016-02-24 10:50:32 (GMT) |
commit | cf19f11b8d2bd6d9566c7528fbed40af06928abf (patch) | |
tree | a373b8e934fa78a1bf9db8afca2e9854437e45da /test | |
parent | 7212d5a3dbbd2845d09df96b2c345132c8a24931 (diff) | |
download | uscxml-cf19f11b8d2bd6d9566c7528fbed40af06928abf.zip uscxml-cf19f11b8d2bd6d9566c7528fbed40af06928abf.tar.gz uscxml-cf19f11b8d2bd6d9566c7528fbed40af06928abf.tar.bz2 |
Some more refactoring and VHDL transformation
Diffstat (limited to 'test')
-rw-r--r-- | test/src/test-arabica-events.cpp | 2 | ||||
-rw-r--r-- | test/src/test-arabica-namespaces.cpp | 10 | ||||
-rw-r--r-- | test/src/test-base64.cpp | 2 | ||||
-rw-r--r-- | test/src/test-c-machine.cpp | 8 | ||||
-rw-r--r-- | test/src/test-datamodel.cpp | 4 | ||||
-rw-r--r-- | test/src/test-ffmpeg.cpp | 2 | ||||
-rw-r--r-- | test/src/test-lifecycle.cpp | 2 | ||||
-rw-r--r-- | test/src/test-sockets.cpp | 4 | ||||
-rw-r--r-- | test/src/test-stress.cpp | 2 | ||||
-rw-r--r-- | test/src/test-vxml-mmi-socket.cpp | 2 | ||||
-rw-r--r-- | test/src/test-w3c.cpp | 2 | ||||
-rw-r--r-- | test/w3c/run_generated_test.cmake | 28 |
12 files changed, 41 insertions, 27 deletions
diff --git a/test/src/test-arabica-events.cpp b/test/src/test-arabica-events.cpp index 0cd45ee..bcec093 100644 --- a/test/src/test-arabica-events.cpp +++ b/test/src/test-arabica-events.cpp @@ -56,7 +56,7 @@ int main(int argc, char** argv) { Arabica::XPath::XPath<std::string> xpath; Arabica::XPath::NodeSet<std::string> divs = xpath.evaluate("//div", doc).asNodeSet(); - for (int i = 0; i < divs.size(); i++) { + for (size_t i = 0; i < divs.size(); i++) { Element<std::string> divElem = Element<std::string>(divs[i]); divElem.setAttribute("foo", "true"); divElem.setAttribute("foo", "false"); diff --git a/test/src/test-arabica-namespaces.cpp b/test/src/test-arabica-namespaces.cpp index ced9578..5d5d90d 100644 --- a/test/src/test-arabica-namespaces.cpp +++ b/test/src/test-arabica-namespaces.cpp @@ -67,7 +67,7 @@ void insertBar(std::pair<Document<std::string>, NameSpaceInfo>& parsed) { Document<std::string> document = parsed.first; Node<std::string> root = document.getDocumentElement(); - for (int i = 0; i < 3; i++) { + for (size_t i = 0; i < 3; i++) { Element<std::string> bar = document.createElementNS(nsInfo.nsURL, "bar"); // if (nsInfo.nsToPrefix.find(nsInfo.nsURL) != nsInfo.nsToPrefix.end()) nsInfo.setPrefix(bar); @@ -80,7 +80,7 @@ void insertBaz(std::pair<Document<std::string>, NameSpaceInfo>& parsed) { Document<std::string> document = parsed.first; Node<std::string> root = document.getDocumentElement(); - for (int i = 0; i < 3; i++) { + for (size_t i = 0; i < 3; i++) { Element<std::string> baz = document.createElementNS(nsInfo.nsURL, "baz"); nsInfo.setPrefix(baz); root.appendChild(baz); @@ -102,7 +102,7 @@ static void validateRootFoo(std::pair<Document<std::string>, NameSpaceInfo>& par NodeSet<std::string> foosXPath = _xpath.evaluate("//" + nsInfo.xpathPrefix + "foo", root).asNodeSet(); assert(foosXPath.size() == 3); - for (int i = 0; i < 3; i++) { + for (size_t i = 0; i < 3; i++) { assert(foosFiltered[i] == foosXPath[i]); assert(TAGNAME_CAST(foosFiltered[i]) == nsInfo.xmlNSPrefix + "foo"); assert(LOCALNAME_CAST(foosFiltered[i]) == "foo"); @@ -124,7 +124,7 @@ static void validateRootFooBar(std::pair<Document<std::string>, NameSpaceInfo>& NodeSet<std::string> barsXPath = _xpath.evaluate("//" + nsInfo.xpathPrefix + "bar", root).asNodeSet(); assert(barsXPath.size() == 3); - for (int i = 0; i < 3; i++) { + for (size_t i = 0; i < 3; i++) { assert(barsFiltered[i] == barsXPath[i]); assert(TAGNAME_CAST(barsFiltered[i]) == nsInfo.xmlNSPrefix + "bar"); assert(LOCALNAME_CAST(barsFiltered[i]) == "bar"); @@ -149,7 +149,7 @@ static void validateRootFooBarBaz(std::pair<Document<std::string>, NameSpaceInfo NodeSet<std::string> bazsXPath = _xpath.evaluate("//" + nsInfo.xpathPrefix + "baz", root).asNodeSet(); assert(bazsXPath.size() == 3); - for (int i = 0; i < 3; i++) { + for (size_t i = 0; i < 3; i++) { assert(bazsFiltered[i] == bazsXPath[i]); assert(TAGNAME_CAST(bazsFiltered[i]) == nsInfo.xmlNSPrefix + "baz"); assert(LOCALNAME_CAST(bazsFiltered[i]) == "baz"); diff --git a/test/src/test-base64.cpp b/test/src/test-base64.cpp index 1267b7b..4981a26 100644 --- a/test/src/test-base64.cpp +++ b/test/src/test-base64.cpp @@ -9,7 +9,7 @@ int main(int argc, char** argv) { std::string base64C; char buffer[SOURCE_LEN]; - for (int i = 0; i < SOURCE_LEN; i++) { + for (size_t i = 0; i < SOURCE_LEN; i++) { buffer[i] = (char)55; } diff --git a/test/src/test-c-machine.cpp b/test/src/test-c-machine.cpp index 815993e..f78e970 100644 --- a/test/src/test-c-machine.cpp +++ b/test/src/test-c-machine.cpp @@ -242,7 +242,7 @@ public: } bool isInState(const std::string& stateId) { - for (int i = 0 ; i < ctx.machine->nr_states; i++) { + for (size_t i = 0 ; i < ctx.machine->nr_states; i++) { if (ctx.machine->states[i].name != NULL && BIT_HAS(i, ctx.config) && stateId == ctx.machine->states[i].name) return true; } @@ -797,7 +797,7 @@ public: std::string seperator; size_t start = 0; - for (int i = 0; i < text.size(); i++) { + for (size_t i = 0; i < text.size(); i++) { if (isspace(text[i])) { if (i > 0 && start < i) { content << seperator << text.substr(start, i - start); @@ -823,7 +823,7 @@ public: size_t start = 0; std::string eventDesc; - for (int i = 0; i < eventDescs.size(); i++) { + for (size_t i = 0; i < eventDescs.size(); i++) { if (isspace(eventDescs[i])) { if (i > 0 && start < i - 1) { eventDesc = eventDescs.substr(start, i - start); @@ -960,7 +960,7 @@ int main(int argc, char** argv) { rootMachine.dataModel.timer.elapsed = 0; #endif size_t passIdx = 0; - for (int i = 0; i < rootMachine.ctx.machine->nr_states; i++) { + for (size_t i = 0; i < rootMachine.ctx.machine->nr_states; i++) { if (rootMachine.ctx.machine->states[i].name && strcmp(rootMachine.ctx.machine->states[i].name, "pass") == 0) { passIdx = i; break; diff --git a/test/src/test-datamodel.cpp b/test/src/test-datamodel.cpp index 12f74e6..0c02ae8 100644 --- a/test/src/test-datamodel.cpp +++ b/test/src/test-datamodel.cpp @@ -38,7 +38,7 @@ int main(int argc, char** argv) { { char* testData = (char*)malloc(1024); - for (int i = 0; i < 1024; i++) { + for (size_t i = 0; i < 1024; i++) { testData[i] = (char)i; } @@ -46,7 +46,7 @@ int main(int argc, char** argv) { Blob blob = data.getBinary(); char* otherData = blob.getData(); - for (int i = 0; i < 1024; i++) { + for (size_t i = 0; i < 1024; i++) { assert(testData[i] == otherData[i]); } diff --git a/test/src/test-ffmpeg.cpp b/test/src/test-ffmpeg.cpp index a8660e5..1c99aa5 100644 --- a/test/src/test-ffmpeg.cpp +++ b/test/src/test-ffmpeg.cpp @@ -339,7 +339,7 @@ int main(int argc, char **argv) { if (frame) frame->pts = 0; - for (int i = 0; i < 125; i++) { + for (size_t i = 0; i < 125; i++) { write_video_frame(oc, video_st); frame->pts += av_rescale_q(1, video_st->codec->time_base, video_st->time_base); } diff --git a/test/src/test-lifecycle.cpp b/test/src/test-lifecycle.cpp index eeaad96..e61d6db 100644 --- a/test/src/test-lifecycle.cpp +++ b/test/src/test-lifecycle.cpp @@ -28,7 +28,7 @@ bool testIssue56(); #ifdef HAS_EXECINFO_H void printBacktrace(void** array, int size) { char** messages = backtrace_symbols(array, size); - for (int i = 0; i < size && messages != NULL; ++i) { + for (size_t i = 0; i < size && messages != NULL; ++i) { std::cerr << "\t" << messages[i] << std::endl; } std::cerr << std::endl; diff --git a/test/src/test-sockets.cpp b/test/src/test-sockets.cpp index 16234ee..89e6885 100644 --- a/test/src/test-sockets.cpp +++ b/test/src/test-sockets.cpp @@ -80,7 +80,7 @@ int main(int argc, char** argv) { int iterations = 1000; std::stringstream contentSS; - for (int i = 0; i < iterations; i++) { + for (size_t i = 0; i < iterations; i++) { contentSS << toStr(i); contentSS << "tadaa!"; } @@ -99,7 +99,7 @@ int main(int argc, char** argv) { client.connect("127.0.0.1", 1235); int iterations = 1000; - for (int i = 0; i < iterations; i++) { + for (size_t i = 0; i < iterations; i++) { client.write(toStr(i)); client.write("\0", 1); } diff --git a/test/src/test-stress.cpp b/test/src/test-stress.cpp index 220399a..0099f9b 100644 --- a/test/src/test-stress.cpp +++ b/test/src/test-stress.cpp @@ -30,7 +30,7 @@ int lastTransitionAt; #ifdef HAS_EXECINFO_H void printBacktrace(void** array, int size) { char** messages = backtrace_symbols(array, size); - for (int i = 0; i < size && messages != NULL; ++i) { + for (size_t i = 0; i < size && messages != NULL; ++i) { std::cerr << "\t" << messages[i] << std::endl; } std::cerr << std::endl; diff --git a/test/src/test-vxml-mmi-socket.cpp b/test/src/test-vxml-mmi-socket.cpp index 4db7109..b89a65a 100644 --- a/test/src/test-vxml-mmi-socket.cpp +++ b/test/src/test-vxml-mmi-socket.cpp @@ -135,7 +135,7 @@ int main(int argc, char** argv) { std::stringstream newCtxReqXMLSS; newCtxReqXMLSS << newCtxReqXML; - for (int i = 0; i < 100000; i++) { + for (size_t i = 0; i < 100000; i++) { std::string index = toStr(i); client.write(index.c_str(), index.size() + 1); // client.write(newCtxReqXMLSS.str().data(), newCtxReqXMLSS.str().size()); diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp index 669db30..baa963b 100644 --- a/test/src/test-w3c.cpp +++ b/test/src/test-w3c.cpp @@ -180,7 +180,7 @@ int main(int argc, char** argv) { Arabica::DOM::Element<std::string> root = document.getDocumentElement(); Arabica::XPath::NodeSet<std::string> sends = DOMUtils::filterChildElements(interpreter.getNameSpaceInfo().xmlNSPrefix + "send", root, true); - for (int i = 0; i < sends.size(); i++) { + for (size_t i = 0; i < sends.size(); i++) { Arabica::DOM::Element<std::string> send = Arabica::DOM::Element<std::string>(sends[i]); if (HAS_ATTR(send, "delay")) { NumAttr delay(ATTR(send, "delay")); diff --git a/test/w3c/run_generated_test.cmake b/test/w3c/run_generated_test.cmake index 334fffb..802acf1 100644 --- a/test/w3c/run_generated_test.cmake +++ b/test/w3c/run_generated_test.cmake @@ -6,22 +6,36 @@ include("${CMAKE_MODULE_PATH}/FileInformation.cmake") get_filename_component(TEST_FILE_NAME ${TESTFILE} NAME) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTDIR}) -message(STATUS "${USCXML_TRANSFORM_BIN} -t${TARGETLANG} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.machine.c") -execute_process(COMMAND time -p ${USCXML_TRANSFORM_BIN} -t${TARGETLANG} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.machine.c RESULT_VARIABLE CMD_RESULT) -if(CMD_RESULT) - message(FATAL_ERROR "Error running ${USCXML_TRANSFORM_BIN}: ${CMD_RESULT}") -endif() -message(STATUS "time for transforming to c machine") # message(FATAL_ERROR "PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}") if (${TARGETLANG} STREQUAL "vhdl") + find_program(GHDL ghdl) - message(STATUS ${OUTDIR}/${TEST_FILE_NAME}) + execute_process(COMMAND time -p ${USCXML_TRANSFORM_BIN} -t${TARGETLANG} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.machine.vhdl RESULT_VARIABLE CMD_RESULT) + if(CMD_RESULT) + message(FATAL_ERROR "Error running ${USCXML_TRANSFORM_BIN}: ${CMD_RESULT}") + endif() + message(STATUS "time for transforming to VHDL machine") + message(STATUS "${GHDL} -a ${OUTDIR}/${TEST_FILE_NAME}.machine.vhdl") + execute_process( + COMMAND time -p ${GHDL} -a ${OUTDIR}/${TEST_FILE_NAME}.machine.vhdl + WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT) + if(CMD_RESULT) + message(FATAL_ERROR "Error running ghdl ${GHDL}: ${CMD_RESULT}") + endif() + message(STATUS "time for transforming to binary") elseif (${TARGETLANG} STREQUAL "c") + message(STATUS "${USCXML_TRANSFORM_BIN} -t${TARGETLANG} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.machine.c") + execute_process(COMMAND time -p ${USCXML_TRANSFORM_BIN} -t${TARGETLANG} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.machine.c RESULT_VARIABLE CMD_RESULT) + if(CMD_RESULT) + message(FATAL_ERROR "Error running ${USCXML_TRANSFORM_BIN}: ${CMD_RESULT}") + endif() + message(STATUS "time for transforming to c machine") + # set(COMPILE_CMD_OBJ # "-c" "${OUTDIR}/${TEST_FILE_NAME}.machine.c" # "-o" "${OUTDIR}/${TEST_FILE_NAME}.machine.c.o" |