/* * test_oversize_mask.sli * * This file is part of NEST. * * Copyright (C) 2004 The NEST Initiative * * NEST is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * NEST is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NEST. If not, see <http://www.gnu.org/licenses/>. * */ % this test ensures that topology/ConnectLayers :: accepts oversized masks only % when explicitly allowed /unittest (8831) require unittest using /make_grid_layer { << /rows 1 /columns 1 /elements /iaf_neuron /edge_wrap true >> topology/CreateLayer :: } def /make_free_layer { << /positions [[0. 0.]] /elements /iaf_neuron /edge_wrap true >> topology/CreateLayer :: } def % correct, grid-based { make_grid_layer dup << /connection_type (divergent) /mask << /grid << /rows 1 /columns 1 >> >> >> topology/ConnectLayers :: } pass_or_die % incorrect, grid-based, too wide { make_grid_layer dup << /connection_type (divergent) /mask << /grid << /rows 1 /columns 2 >> >> >> topology/ConnectLayers :: } fail_or_die % incorrect, grid-based, too tall { make_grid_layer dup << /connection_type (divergent) /mask << /grid << /rows 2 /columns 1 >> >> >> topology/ConnectLayers :: } fail_or_die % incorrect, grid-based, too wide and tall { make_grid_layer dup << /connection_type (divergent) /mask << /grid << /rows 2 /columns 2 >> >> >> topology/ConnectLayers :: } fail_or_die % correct, grid-based, too wide and tall, but oversized allowed { make_grid_layer dup << /connection_type (divergent) /mask << /grid << /rows 2 /columns 2 >> >> /allow_oversized_mask true >> topology/ConnectLayers :: } pass_or_die % ---------------------------- % correct, circular { make_free_layer dup << /connection_type (divergent) /mask << /circular << /radius 0.5 >> >> >> topology/ConnectLayers :: } pass_or_die % incorrect, circular, too wide { make_free_layer dup << /connection_type (divergent) /mask << /circular << /radius 0.51 >> >> >> topology/ConnectLayers :: } fail_or_die % correct, circular, too wide but allowed { make_free_layer dup << /connection_type (divergent) /mask << /circular << /radius 0.51 >> >> /allow_oversized_mask true >> topology/ConnectLayers :: } pass_or_die % ---------------------------------------------------------- % correct, doughnut { make_free_layer dup << /connection_type (divergent) /mask << /doughnut << /inner_radius 0.2 /outer_radius 0.5 >> >> >> topology/ConnectLayers :: } pass_or_die % incorrect, doughnut, too wide { make_free_layer dup << /connection_type (divergent) /mask << /doughnut << /inner_radius 0.2 /outer_radius 0.51 >> >> >> topology/ConnectLayers :: } fail_or_die % correct, doughnut, too wide but allowed { make_free_layer dup << /connection_type (divergent) /mask << /doughnut << /inner_radius 0.2 /outer_radius 0.51 >> >> /allow_oversized_mask true >> topology/ConnectLayers :: } pass_or_die % ------------------------------------------- % correct, rectangular { make_free_layer dup << /connection_type (divergent) /mask << /rectangular << /lower_left [-0.5 -0.5] /upper_right [0.5 0.5] >> >> >> topology/ConnectLayers :: } pass_or_die % incorrect, rectangular, too wide { make_free_layer dup << /connection_type (divergent) /mask << /rectangular << /lower_left [-0.5 -0.5] /upper_right [0.51 0.5] >> >> >> topology/ConnectLayers :: } fail_or_die % correct, rectangular, too wide but allowed { make_free_layer dup << /connection_type (divergent) /mask << /rectangular << /lower_left [-0.5 -0.5] /upper_right [0.51 0.5] >> >> /allow_oversized_mask true >> topology/ConnectLayers :: } pass_or_die endusing