@Test public void canSetLayersOnAnUninitializedNetwork() { assertEquals(0, network.getLayers().size()); Set<Layer> layers = new HashSet<Layer>(); layers.add(new Layer()); layers.add(new Layer()); layers.add(new Layer()); network.setLayers(layers); assertEquals(layers, network.getLayers()); }
@Test public void initializedNetworkHasLayers() { List<Layer> layers = new ArrayList<Layer>(); layers.add(new Layer()); layers.add(new Layer()); layers.add(new Layer()); NeuralNetworkImpl network = new NeuralNetworkImpl(layers); assertEquals(layers, network.getLayers()); }
@Test public void addLayersAddsLayersToNullLayerList() { network.setLayers(null); List<Layer> layers = new ArrayList<Layer>(); layers.add(new Layer()); layers.add(new Layer()); network.addLayers(layers); assertEquals(2, network.getLayers().size()); }
@Test public void addLayersWithANullListDoesntRemoveOldLayers() { List<Layer> layers = new ArrayList<Layer>(); layers.add(new Layer()); layers.add(new Layer()); layers.add(new Layer()); NeuralNetworkImpl network = new NeuralNetworkImpl(layers); network.addLayers(null); assertEquals(3, network.getLayers().size()); }
@Test public void addLayersAddsUniqueLayers() { List<Layer> layers = new ArrayList<Layer>(); layers.add(new Layer()); layers.add(new Layer()); layers.add(new Layer()); NeuralNetworkImpl network = new NeuralNetworkImpl(layers); layers = new ArrayList<Layer>(); layers.add(new Layer()); layers.add(new Layer()); network.addLayers(layers); assertEquals(5, network.getLayers().size()); }
@Test public void addLayerDoesntAddExistingLayer() { List<Layer> layers = new ArrayList<Layer>(); Layer oldLayer = new Layer(); layers.add(oldLayer); layers.add(new Layer()); layers.add(new Layer()); NeuralNetworkImpl network = new NeuralNetworkImpl(layers); layers = new ArrayList<Layer>(); layers.add(oldLayer); layers.add(new Layer()); network.addLayers(layers); assertEquals(4, network.getLayers().size()); }
@Test public void uninitializedNetworkHasEmptyLayers() { assertEquals(0, network.getLayers().size()); }