assertTrue(ccc.get(1).connection == l.getConnections().get(1));
assertTrue(ccc.get(2).connection == l.getConnections().get(2));
l = l.getConnections().get(2).getOutputLayer();
assertTrue(ccc.get(3).connection == l.getConnections().get(1));
ccc = new BreadthFirstOrderStrategy(mlp, mlp.getOutputLayer()).order();
assertEquals(4, ccc.size(), 0);
l = mlp.getOutputLayer();
assertTrue(ccc.get(0).connection == l.getConnections().get(0));
assertTrue(ccc.get(1).connection == l.getConnections().get(1));
l = l.getConnections().get(0).getInputLayer();
assertTrue(ccc.get(2).connection == l.getConnections().get(0));
assertTrue(ccc.get(3).connection == l.getConnections().get(1));
// Simple MLP
mlp = NNFactory.mlp(new int[] {3, 4}, true);
calculated = new HashSet<Layer>();
calculated.add(mlp.getInputLayer());
ccc = new TargetLayerOrderStrategy(mlp, mlp.getOutputLayer(), calculated).order();
assertEquals(2, ccc.size(), 0);
l = mlp.getOutputLayer();
assertTrue(ccc.get(0).connection == l.getConnections().get(0));
assertTrue(ccc.get(1).connection == l.getConnections().get(1));
ccc = new BreadthFirstOrderStrategy(mlp, mlp.getOutputLayer()).order();
assertEquals(2, ccc.size(), 0);
l = mlp.getOutputLayer();
assertTrue(ccc.get(0).connection == l.getConnections().get(0));
assertTrue(ccc.get(1).connection == l.getConnections().get(1));
// CNN
NeuralNetworkImpl cnn = NNFactory.convNN(new int[][] { { 3, 3, 2 }, { 2, 2, 1, 1 } }, true);
calculated = new HashSet<Layer>();
calculated.add(cnn.getInputLayer());
ccc = new TargetLayerOrderStrategy(cnn, cnn.getOutputLayer(), calculated).order();
l = cnn.getOutputLayer();
assertEquals(2, ccc.size(), 0);
assertTrue(ccc.get(0).connection == l.getConnections().get(0));
assertTrue(ccc.get(1).connection == l.getConnections().get(1));
ccc = new BreadthFirstOrderStrategy(cnn, cnn.getOutputLayer()).order();
l = cnn.getOutputLayer();
assertEquals(2, ccc.size(), 0);
assertTrue(ccc.get(0).connection == l.getConnections().get(0));
assertTrue(ccc.get(1).connection == l.getConnections().get(1));
}