1/* 2 * ticket-580.sli 3 * 4 * This file is part of NEST. 5 * 6 * Copyright (C) 2004 The NEST Initiative 7 * 8 * NEST is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation, either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * NEST is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with NEST. If not, see <http://www.gnu.org/licenses/>. 20 * 21 */ 22 23/** @BeginDocumentation 24 25Name: testsuite::ticket-580 - getinterval: No error if range of array is exceeded 26 27Synopsis: (ticket-564) run -> NEST exits if test fails 28 29Description: 301) This test checks whether the sli functions getinterval and Take perform Range Checks, i.e. whether they throw errors if the requested part of the interval exceeds the original array or not. 312) Furthermore, it checks whether getinterval throws an error if negative indices are given and whether Takes does not throw an error. 323) Checks whether Take returns an empty array if n_2 < n_1 33 34In addition, it checks whether they return the same results for a correct usage. 35 36Author: Maximilian Schmidt, 2012-10-16 37 */ 38 39(unittest) run 40/unittest using 41 42M_ERROR setverbosity 43 44 45[0 2] Range /x Set 46(Hallo) /y Set 47 48 49{ 50 x [1 4] Take 51} fail_or_die 52 53{ 54 x [2 1] Take 55 [] eq 56} assert_or_die 57 58{ 59 x -2 Take 60 [1 2] eq 61} assert_or_die 62 63{ 64 x [-2 -1] Take 65 [1 2] eq 66} assert_or_die 67 68{ 69 x 0 Take 70 [] eq 71} assert_or_die 72 73{ 74 x 0 4 getinterval 75} fail_or_die 76 77{ 78 x -2 2 getinterval 79} fail_or_die 80 81{ 82 x 0 -1 getinterval 83} fail_or_die 84 85 86{ 87 y -2 2 getinterval 88} fail_or_die 89 90{ 91 y 0 6 getinterval 92} fail_or_die 93 94{ 95 y 0 -1 getinterval 96} fail_or_die 97 98{ 99 x [1 3] Take 100 x 0 3 getinterval 101 eq 102} assert_or_die 103 104 105endusing 106