forked from M-Labs/artiq
1
0
Fork 0

compiler: Add test for length of empty arrays [nfc]

This makes sure we are actually emitting this as an 1D array
(like NumPy does).
This commit is contained in:
David Nadlinger 2020-07-25 22:38:01 +01:00
parent d882f8a3f0
commit 40f59561f2
1 changed files with 5 additions and 0 deletions

View File

@ -6,5 +6,10 @@ assert len(ary) == 3
# FIXME: Implement ndarray indexing
# assert [x*x for x in ary] == [1, 4, 9]
# Reassign to an existing value to disambiguate type of empty array.
empty_array = array([1])
empty_array = array([])
assert len(empty_array) == 0
matrix = array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
assert len(matrix) == 2