@Test public void removesNonexistentLayer() { Set<Layer> layers = new HashSet<Layer>(); Layer topLayer = new Layer(); Layer middleLayer = new Layer(); Layer bottomLayer = new Layer(); layers.add(topLayer); layers.add(middleLayer); layers.add(bottomLayer); network.setLayers(layers); assertTrue(network.removeLayer(new Layer())); }
@Test public void removesTopAndMiddleLayer() { Set<Layer> layers = new HashSet<Layer>(); Layer topLayer = new Layer(); Layer middleLayer = new Layer(); Layer bottomLayer = new Layer(); Connections firstConnection = new FullyConnected(topLayer, middleLayer, 0, 0); Connections secondConnection = new FullyConnected(middleLayer, bottomLayer, 0, 0); topLayer.addConnection(firstConnection); middleLayer.addConnection(firstConnection); middleLayer.addConnection(secondConnection); bottomLayer.addConnection(secondConnection); layers.add(topLayer); layers.add(middleLayer); layers.add(bottomLayer); network.setLayers(layers); assertTrue(network.removeLayer(topLayer)); assertTrue(network.removeLayer(middleLayer)); }
@Test public void removeLayerFromNullLayerList() { network.setLayers(null); assertFalse(network.removeLayer(new Layer())); }
@Test public void removeLayerDoesntRemoveNullLayer() { assertFalse(network.removeLayer(null)); }