浏览代码

Allow input-based tests again in linkable

Yentl Van Tendeloo 9 年之前
父节点
当前提交
33bd50f5e7
共有 2 个文件被更改,包括 6 次插入20 次删除
  1. 2 19
      integration/test_constructors_al_linkable.py
  2. 4 1
      integration/utils.py

+ 2 - 19
integration/test_constructors_al_linkable.py

@@ -111,23 +111,6 @@ class TestConstructorsActionLanguageLinkable(unittest.TestCase):
         commands = extend_commands(commands)
         commands = extend_commands(commands)
         self.assertTrue(run_barebone(commands, [None], None, timeout=True, link=["test.o"]))
         self.assertTrue(run_barebone(commands, [None], None, timeout=True, link=["test.o"]))
 
 
-    """
-    def test_constructors_addition(self):
-        commands = [('"output"',
-                        ('"call"',
-                            ('"deref"', '"primitives/integer_addition"'),
-                            '2',
-                            ('"const"', '1'),
-                            ('"const"', '5'),
-                            'false',
-                        ),
-                        'true',
-                        ('"return"', 'true', '"const"', 'true'),
-                    )
-                ]
-        self.assertTrue(run_barebone(flatten(commands), ["6"], 1))
-    """
-
     def test_constructors_while_false(self):
     def test_constructors_while_false(self):
         commands = [
         commands = [
                         '"while"',                 # While
                         '"while"',                 # While
@@ -186,7 +169,6 @@ class TestConstructorsActionLanguageLinkable(unittest.TestCase):
         commands = extend_commands(commands)
         commands = extend_commands(commands)
         self.assertTrue(run_barebone(commands, ["5"], None, link=["test.o"]))
         self.assertTrue(run_barebone(commands, ["5"], None, link=["test.o"]))
 
 
-    """
     def test_constructors_output_input(self):
     def test_constructors_output_input(self):
         commands = [
         commands = [
                      '"output"',
                      '"output"',
@@ -198,8 +180,9 @@ class TestConstructorsActionLanguageLinkable(unittest.TestCase):
                     'false',
                     'false',
                 ]
                 ]
         commands = extend_commands(commands)
         commands = extend_commands(commands)
-        self.assertTrue(run_barebone(commands + ['123456'], ["123456"], None, link=["test.o"]))
+        self.assertTrue(run_barebone(commands, ["123456"], None, link=["test.o"], inputs=["123456"]))
 
 
+    """
     def test_constructors_funcdecl(self):
     def test_constructors_funcdecl(self):
         commands = ['"declare"',
         commands = ['"declare"',
                         1,
                         1,

+ 4 - 1
integration/utils.py

@@ -181,7 +181,7 @@ def run_file(files, parameters, expected, mode):
         except UnboundLocalError:
         except UnboundLocalError:
             pass
             pass
             
             
-def run_barebone(parameters, expected, interface="0", timeout=False, wait=False, link=None):
+def run_barebone(parameters, expected, interface="0", timeout=False, wait=False, link=None, inputs=[]):
     port = getFreePort()
     port = getFreePort()
     address = "http://localhost:%i" % port
     address = "http://localhost:%i" % port
     try:
     try:
@@ -247,6 +247,9 @@ def run_barebone(parameters, expected, interface="0", timeout=False, wait=False,
                     print("Linking timeout expired!")
                     print("Linking timeout expired!")
                     return False
                     return False
 
 
+        for inp in inputs:
+            urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "element_type": "V", "value": inp, "username": username})), timeout=1).read()
+
         counter = 0
         counter = 0
         for e in expected:
         for e in expected:
             print("Expect " + str(e))
             print("Expect " + str(e))