/*
* test_get_node_fncs.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/>.
*
*/
/* BeginDocumentation
Name: testsuite::test_get_node_fncs - sli script for test of Get(Local/Global)(Nodes/Leaves/Children)
Synopsis: nest_indirect test_get_node_fncs --> success
Description:
The following network is created
0
__|__
/ / \ \
1 2 3 4
__|__
/ / \ \
5 6 7 8
|
/ \
9 10
where the gids 0, 3, 4, 7 and 8 refer to subnets.
test_get_node_fncs checks if GetGlobalNodes, GetLocalNodes,
GetGlobalLeaves, GetLocalLeaves, GetGlobalChildren, GetLocalChildren
return the correct array of gids when given the subnet gids 0, 3, 8
and 4.
Author: February 2012, Kunkel
*/
/unittest (9715) require
/unittest using
[1 2 4] % check for 1, 2 and 4 processes
{
/iaf_neuron 2 Create ; % gids 1,2
/subnet 2 Create ; % gids 3,4
3 ChangeSubnet
/iaf_neuron 2 Create ; % gids 5,6
/subnet 2 Create ; % gids 7,8
8 ChangeSubnet
/iaf_neuron 2 Create ; % gids 9,10
0 GetGlobalNodes [1 2 3 4 5 6 7 8 9 10] eq
3 GetGlobalNodes [5 6 7 8 9 10] eq and
8 GetGlobalNodes [9 10] eq and
4 GetGlobalNodes empty exch pop and
0 GetLocalNodes [1 2 3 4 5 6 7 8 9 10] {dup [3 4 7 8] exch MemberQ exch NumProcesses mod Rank eq or} Select eq and
3 GetLocalNodes [5 6 7 8 9 10] {dup [3 4 7 8] exch MemberQ exch NumProcesses mod Rank eq or} Select eq and
8 GetLocalNodes [9 10] {dup [3 4 7 8] exch MemberQ exch NumProcesses mod Rank eq or} Select eq and
4 GetLocalNodes empty exch pop and
0 GetGlobalLeaves [1 2 5 6 9 10] eq and
3 GetGlobalLeaves [5 6 9 10] eq and
8 GetGlobalLeaves [9 10] eq and
4 GetGlobalLeaves empty exch pop and
0 GetLocalLeaves [1 2 5 6 9 10] {dup [3 4 7 8] exch MemberQ exch NumProcesses mod Rank eq or} Select eq and
3 GetLocalLeaves [5 6 9 10] {dup [3 4 7 8] exch MemberQ exch NumProcesses mod Rank eq or} Select eq and
8 GetLocalLeaves [9 10] {dup [3 4 7 8] exch MemberQ exch NumProcesses mod Rank eq or} Select eq and
4 GetLocalLeaves empty exch pop and
0 GetGlobalChildren [1 2 3 4] eq and
3 GetGlobalChildren [5 6 7 8] eq and
8 GetGlobalChildren [9 10] eq and
4 GetGlobalChildren empty exch pop and
0 GetLocalChildren [1 2 3 4] {dup [3 4 7 8] exch MemberQ exch NumProcesses mod Rank eq or} Select eq and
3 GetLocalChildren [5 6 7 8] {dup [3 4 7 8] exch MemberQ exch NumProcesses mod Rank eq or} Select eq and
8 GetLocalChildren [9 10] {dup [3 4 7 8] exch MemberQ exch NumProcesses mod Rank eq or} Select eq and
4 GetLocalChildren empty exch pop and
}
distributed_collect_assert_or_die