diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-11-05 21:35:25 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-11-05 21:35:25 -0700 |
commit | cb48c5d79ca41d4b8d6f44f54cca53bfcb7b8670 (patch) | |
tree | dc7fb84e9dba3743dc0f88f937fbc98693ce5d6d | |
parent | 2e57fed3596983b3f8b2fed3694cb50bf4e3eef7 (diff) | |
download | mu-cb48c5d79ca41d4b8d6f44f54cca53bfcb7b8670.tar.gz |
3625 - gracefully handle fractional array index
Follow-up to commit 3622. Even though there's no code change that's just a happy accident; we hadn't at all considered this constraint thus far.
-rw-r--r-- | 032array.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/032array.cc b/032array.cc index b8b4088a..c9182912 100644 --- a/032array.cc +++ b/032array.cc @@ -305,6 +305,17 @@ void test_array_length_compound() { CHECK_EQ(array_length(x), 3); } +:(scenario index_truncates) +def main [ + 1:array:num:3 <- create-array + 2:num <- copy 14 + 3:num <- copy 15 + 4:num <- copy 16 + 5:num <- index 1:array:num:3, 1.5 # non-whole number +] +# fraction is truncated away ++mem: storing 15 in location 5 + :(scenario index_out_of_bounds) % Hide_errors = true; def main [ |