From 7bdd6785b7735b6fa867d21253c1623b9cb6ecef Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Wed, 29 Jul 2020 23:22:50 +0100 Subject: [PATCH] test/lit: Basic ndarray smoke tests for all binops --- artiq/test/lit/integration/array_ops.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/artiq/test/lit/integration/array_ops.py b/artiq/test/lit/integration/array_ops.py index 72d2f0812..cf511d0d8 100644 --- a/artiq/test/lit/integration/array_ops.py +++ b/artiq/test/lit/integration/array_ops.py @@ -8,6 +8,11 @@ assert c[0] == 5 assert c[1] == 7 assert c[2] == 9 +c = b - a +assert c[0] == 3 +assert c[1] == 3 +assert c[2] == 3 + c = a * b assert c[0] == 4 assert c[1] == 10 @@ -17,3 +22,19 @@ c = b // a assert c[0] == 4 assert c[1] == 2 assert c[2] == 2 + +c = a ** b +assert c[0] == 1 +assert c[1] == 32 +assert c[2] == 729 + +c = b % a +assert c[0] == 0 +assert c[1] == 1 +assert c[2] == 0 + +# FIXME: Implement array coercion. +# c = b / a +# assert c[0] == 4.0 +# assert c[1] == 2.5 +# assert c[2] == 2.0