From b6b8a7dbc01c53b7602bcb6fd299376049854125 Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Wed, 7 Nov 2018 09:50:08 +0100
Subject: [PATCH] [test][loop_executor] Update tests for DataFormat support

---
 .../test/prefix/algorithms/autonomous/loop/1.json      |  7 +++++--
 .../python/test/prefix/algorithms/autonomous/loop/1.py |  4 ++--
 .../test/prefix/algorithms/autonomous/loop_user/1.json |  8 ++++++++
 .../test/prefix/algorithms/autonomous/loop_user/1.py   |  5 +++--
 beat/backend/python/test/test_loop_executor.py         | 10 ++++++++++
 5 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.json b/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.json
index 65181c1..f407f19 100644
--- a/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.json
+++ b/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.json
@@ -11,8 +11,11 @@
                     "type": "user/single_integer/1"
                 }
             },
-            "outputs": {
-                "out": {
+            "loop": {
+                "input": {
+                    "type": "user/single_integer/1"
+                },
+                "output": {
                     "type": "user/single_integer/1"
                 }
             }
diff --git a/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.py b/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.py
index 4406e7e..5c290d4 100644
--- a/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.py
+++ b/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.py
@@ -28,6 +28,6 @@
 class Algorithm:
 
     def validate(self, result):
-        value = int(result)
+        value = result.value
 
-        return value < 6
+        return value < 6, {'value': 0}
diff --git a/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.json b/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.json
index 43f7a57..044a00c 100644
--- a/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.json
+++ b/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.json
@@ -15,6 +15,14 @@
                 "out": {
                     "type": "user/single_integer/1"
                 }
+            },
+            "loop": {
+                "input": {
+                    "type": "user/single_integer/1"
+                },
+                "output": {
+                    "type": "user/single_integer/1"
+                }
             }
         }
     ]
diff --git a/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.py b/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.py
index 56f50e1..7aef7f6 100644
--- a/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.py
+++ b/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.py
@@ -24,12 +24,13 @@
 # with the BEAT platform. If not, see http://www.gnu.org/licenses/.           #
 #                                                                             #
 ###############################################################################
+import numpy as np
 
 class Algorithm:
 
     def process(self, data_loaders, outputs, loop_channel):
-        cnt = 100
-        while not loop_channel.is_result_valid(cnt):
+        cnt = np.uint8(100)
+        while not loop_channel.is_result_valid({'value': cnt}):
             cnt = cnt - 1
 
         data_loader = data_loaders.loaderOf('in')
diff --git a/beat/backend/python/test/test_loop_executor.py b/beat/backend/python/test/test_loop_executor.py
index 0dce92b..1878e42 100644
--- a/beat/backend/python/test/test_loop_executor.py
+++ b/beat/backend/python/test/test_loop_executor.py
@@ -78,6 +78,16 @@ CONFIGURATION = {
             'channel': 'main'
         }
     },
+    'loop': {
+        'input': {
+            'path': 'LOOP',
+            'channel': 'main'
+        },
+        'output': {
+            'path': 'LOOP',
+            'channel': 'main'
+        }
+    }
 }
 
 
-- 
GitLab