Updated python test
authorLaurent Bessard
Wed, 08 May 2013 22:56:31 +0200
changeset 1099 d9c28879e55b
parent 1098 0ead830daf26
child 1100 1f46424c6220
Updated python test
tests/python/c_code@c_ext/cfile.xml
tests/python/plc.xml
tests/python/python@py_ext/py_ext.xml
tests/python/python@py_ext/pyfile.xml
--- a/tests/python/c_code@c_ext/cfile.xml	Wed May 08 22:53:40 2013 +0200
+++ b/tests/python/c_code@c_ext/cfile.xml	Wed May 08 22:56:31 2013 +0200
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<CFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="cext_xsd.xsd">
+<CodeFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="codefile.xsd">
   <includes>
 <![CDATA[#include "stdio.h"]]>
   </includes>
   <variables>
-    <variable name="TestInput" type="SINT" class="input"/>
-    <variable name="TestOutput" type="SINT" class="output"/>
+    <variable name="TestInput" type="SINT" initial="0"/>
+    <variable name="TestOutput" type="SINT"/>
   </variables>
   <globals>
 <![CDATA[volatile long Lock=0;
@@ -62,4 +62,4 @@
     AtomicCompareExchange((long*)&Lock, 1, 0);
 }]]>
   </publishFunction>
-</CFile>
+</CodeFile>
--- a/tests/python/plc.xml	Wed May 08 22:53:40 2013 +0200
+++ b/tests/python/plc.xml	Wed May 08 22:56:31 2013 +0200
@@ -8,7 +8,7 @@
               productVersion="0.0"
               creationDateTime="2008-12-14T16:21:19"/>
   <contentHeader name="Beremiz Python Support Tests"
-                 modificationDateTime="2013-05-02T10:44:19">
+                 modificationDateTime="2013-05-08T22:43:14">
     <coordinateInfo>
       <pageSize x="1024" y="1024"/>
       <fbd>
@@ -102,18 +102,18 @@
               </type>
             </variable>
           </localVars>
-          <localVars>
-            <variable name="TestInput" address="%IB1.0">
+          <externalVars>
+            <variable name="TestInput">
               <type>
                 <SINT/>
               </type>
             </variable>
-            <variable name="TestOutput" address="%QB1.0">
+            <variable name="TestOutput">
               <type>
                 <SINT/>
               </type>
             </variable>
-          </localVars>
+          </externalVars>
           <localVars>
             <variable name="FromInput">
               <type>
@@ -625,14 +625,14 @@
                 </variable>
               </outputVariables>
             </block>
-            <inVariable localId="27" height="30" width="75">
-              <position x="305" y="770"/>
-              <connectionPointOut>
-                <relPosition x="75" y="15"/>
+            <inVariable localId="27" height="30" width="90">
+              <position x="300" y="770"/>
+              <connectionPointOut>
+                <relPosition x="90" y="15"/>
               </connectionPointOut>
               <expression>TestInput</expression>
             </inVariable>
-            <outVariable localId="28" height="30" width="90">
+            <outVariable localId="28" height="30" width="105">
               <position x="395" y="705"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
@@ -649,7 +649,7 @@
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="27">
                   <position x="415" y="785"/>
-                  <position x="380" y="785"/>
+                  <position x="390" y="785"/>
                 </connection>
               </connectionPointIn>
               <expression>FromInput</expression>
--- a/tests/python/python@py_ext/py_ext.xml	Wed May 08 22:53:40 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<Python xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="py_ext_xsd.xsd">
-<![CDATA[import time,sys,ctypes
-Python_to_C_Call = PLCBinary.Python_to_C_Call
-Python_to_C_Call.restype = ctypes.c_int
-Python_to_C_Call.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)]
-
-def MyPythonFunc(arg):
-    i = ctypes.c_int()
-    if(Python_to_C_Call(arg, i)):
-        res = i.value
-        print "toC:", arg, "from C:", res, "FBID:", FBID
-    else:
-        print "Failed Python_to_C_Call failed"
-        res = None
-    sys.stdout.flush()
-    return res
-
-async_error_test_code = """
-def badaboom():
-    tuple()[0]
-
-import wx
-def badaboomwx():
-    wx.CallAfter(badaboom)
-
-from threading import Timer
-a = Timer(3, badaboom)
-a.start()
-
-b = Timer(6, badaboomwx)
-b.start()
-"""
-]]>
-</Python>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/python/python@py_ext/pyfile.xml	Wed May 08 22:56:31 2013 +0200
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<CodeFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="codefile.xsd">
+  <includes>
+<![CDATA[]]>
+  </includes>
+  <variables>
+    <variable name="Test_Python_Var" type="INT" initial="0"/>
+  </variables>
+  <globals>
+<![CDATA[import time,sys,ctypes
+Python_to_C_Call = PLCBinary.Python_to_C_Call
+Python_to_C_Call.restype = ctypes.c_int
+Python_to_C_Call.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)]
+
+def MyPythonFunc(arg):
+    i = ctypes.c_int()
+    if(Python_to_C_Call(arg, i)):
+        res = i.value
+        print "toC:", arg, "from C:", res, "FBID:", FBID
+    else:
+        print "Failed Python_to_C_Call failed"
+        res = None
+    sys.stdout.flush()
+    return res
+
+async_error_test_code = """
+def badaboom():
+    tuple()[0]
+
+import wx
+def badaboomwx():
+    wx.CallAfter(badaboom)
+
+from threading import Timer
+a = Timer(3, badaboom)
+a.start()
+
+b = Timer(6, badaboomwx)
+b.start()
+"""
+]]>
+  </globals>
+  <initFunction>
+<![CDATA[]]>
+  </initFunction>
+  <cleanUpFunction>
+<![CDATA[]]>
+  </cleanUpFunction>
+  <retrieveFunction>
+<![CDATA[]]>
+  </retrieveFunction>
+  <publishFunction>
+<![CDATA[]]>
+  </publishFunction>
+</CodeFile>