[riot-notifications] [RIOT-OS/RIOT] tests/thread_float: improve console output (#16901)

Martine Lenders notifications at github.com
Tue Sep 28 18:07:56 CEST 2021


@miri64 commented on this pull request.



> +# @author      Marian Buschsieweke <marian.buschsieweke at ovgu.de>
+
+import sys
+from testrunner import run
+
+
+def testfunc(child):
+    child.expect("THREADS CREATED")
+    child.expect("")
+    child.expect("THREAD t1 start")
+    child.expect("THREAD t2 start")
+    child.expect("THREAD t3 start")
+    for _ in range(10):
+        child.expect(r"t(\d): (\d\d\d).\d+")
+        first_thread = int(child.match.group(1))
+        assert 141 == int(child.match.group(2))

I'd be happier, since this is a float test, if the digits after the period would be included into group 2 and this would be
```suggestion
        assert 141 == float(child.match.group(2))
```

and not a comparison for equality, but a check if the value is within a certain ε.

> +
+
+def testfunc(child):
+    child.expect("THREADS CREATED")
+    child.expect("")
+    child.expect("THREAD t1 start")
+    child.expect("THREAD t2 start")
+    child.expect("THREAD t3 start")
+    for _ in range(10):
+        child.expect(r"t(\d): (\d\d\d).\d+")
+        first_thread = int(child.match.group(1))
+        assert 141 == int(child.match.group(2))
+        assert (first_thread == 1) or (first_thread == 3)
+        child.expect(r"t(\d): (\d\d\d).\d+")
+        second_thread = int(child.match.group(1))
+        assert 141 == int(child.match.group(2))

Same here.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16901#pullrequestreview-765661935
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210928/ec402e90/attachment.htm>


More information about the notifications mailing list