瀏覽代碼

Added a number of files to develop and test the yacop communication code generation

jos.itemis@gmail.com 13 年之前
父節點
當前提交
d9dcc1c6a2
共有 2 個文件被更改,包括 94 次插入0 次删除
  1. 15 0
      TestScenarios/test-yacop/CMakeLists.txt
  2. 79 0
      TestScenarios/test-yacop/main.cpp

+ 15 - 0
TestScenarios/test-yacop/CMakeLists.txt

@@ -0,0 +1,15 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+set ( Boost_USE_STATIC_LIBS ON )
+set ( Boost_DEBUG OFF )
+find_package( Boost 1.44 COMPONENTS thread system date_time regex)
+find_library(YACOP_SM NAMES InterfaceTestStatemachineyacop HINTS C:/Users/seger/runtime-HMIDevel/TestScenarios/src-gen-yacop/build)
+find_library(YACOP_COM NAMES YakinduCom HINTS C:/Users/seger/workspace-hmi-allplugins/YakinduCom/build/src)
+
+include_directories(${Boost_INCLUDE_DIRS} src "C:/segerlocal/include" "../src-gen-yacop")
+
+add_executable(InterfaceTestStatemachineMain main.cpp)
+target_link_libraries(InterfaceTestStatemachineMain ${YACOP_SM} ${YACOP_COM} 
+${Boost_LIBRARIES})
+

+ 79 - 0
TestScenarios/test-yacop/main.cpp

@@ -0,0 +1,79 @@
+
+#include <iostream>
+#include <cstdlib>
+#include <cassert>
+#include <cstring>
+#include <string>
+#include "Timer.h"
+#include "DummyTimer.h"
+#include "InterfaceTestStatemachineOOY.hpp"
+#include "log.h"
+
+extern Logger logger;
+
+/*@Test: test_default_interface good case, guard matches */
+int first()
+{
+	/* set up dummy Timer */
+	Timer dummyTimer;
+	dummyTimer_init(&dummyTimer);
+
+	logger.setLevel(Logger::LOG_INFO);
+
+	InterfaceTestStatemachineOOY machine("127.0.0.1", 2002, &dummyTimer);
+
+	// wait for the setup
+	machine.runCycle();
+	machine.get_ifaceOther()->set_v1(12);
+	std::cout << "raise event 1\n";
+	machine.get_iface()->raise_event1();
+
+	machine.runCycle();
+
+	std::cout << "other.v1 = " << machine.get_ifaceOther()->get_v1() << std::endl;
+
+	std::cout << "raise event 1\n";
+	machine.get_iface()->raise_event1();
+
+	machine.runCycle();
+
+	std::cout << "other.v1 = " << machine.get_ifaceOther()->get_v1() << std::endl;
+
+	std::cout << "raise event 3\n";
+	machine.get_ifaceOther()->raise_event3();
+
+	machine.runCycle();
+
+	std::cout << "raise event 3\n";
+	machine.get_ifaceOther()->raise_event3();
+
+	machine.runCycle();
+
+	std::cout << "raise event 5\n";
+	machine.get_iface()->set_var1(bool_true);
+	machine.get_ifaceThird()->raise_event5();
+
+	machine.runCycle();
+
+	std::cout << "raise event 5\n";
+	machine.get_ifaceThird()->raise_event5();
+
+	machine.runCycle();
+
+	return 0;
+}
+
+int main(int argc, char** argv)
+{
+	if (argc != 2)
+		return -1;
+
+	switch (atoi(argv[1])) {
+	case 1:
+		return first();
+	}
+
+	return 0;
+
+}
+