JUnit5 assertThrows NeuronSquareMesh2DTest (#216)
This commit is contained in:
parent
15b2e50328
commit
a1ac185ba9
|
@ -36,32 +36,37 @@ import org.apache.commons.math4.neuralnet.Network;
|
||||||
import org.apache.commons.math4.neuralnet.Neuron;
|
import org.apache.commons.math4.neuralnet.Neuron;
|
||||||
import org.apache.commons.math4.neuralnet.SquareNeighbourhood;
|
import org.apache.commons.math4.neuralnet.SquareNeighbourhood;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link NeuronSquareMesh2D} and {@link Network} functionality for
|
* Tests for {@link NeuronSquareMesh2D} and {@link Network} functionality for
|
||||||
* a two-dimensional network.
|
* a two-dimensional network.
|
||||||
*/
|
*/
|
||||||
public class NeuronSquareMesh2DTest {
|
public class NeuronSquareMesh2DTest {
|
||||||
|
|
||||||
private final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create();
|
private final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create();
|
||||||
private final FeatureInitializer init = FeatureInitializerFactory.uniform(rng, 0, 2);
|
private final FeatureInitializer init = FeatureInitializerFactory.uniform(rng, 0, 2);
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test
|
||||||
public void testMinimalNetworkSize1() {
|
public void testMinimalNetworkSize1() {
|
||||||
final FeatureInitializer[] initArray = {init};
|
final FeatureInitializer[] initArray = {init};
|
||||||
|
|
||||||
new NeuronSquareMesh2D(1, false,
|
assertThrows(IllegalArgumentException.class, () ->
|
||||||
2, false,
|
new NeuronSquareMesh2D(1, false,
|
||||||
SquareNeighbourhood.VON_NEUMANN,
|
2, false,
|
||||||
initArray);
|
SquareNeighbourhood.VON_NEUMANN,
|
||||||
|
initArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test
|
||||||
public void testMinimalNetworkSize2() {
|
public void testMinimalNetworkSize2() {
|
||||||
final FeatureInitializer[] initArray = {init};
|
final FeatureInitializer[] initArray = {init};
|
||||||
|
|
||||||
new NeuronSquareMesh2D(2, false,
|
assertThrows(IllegalArgumentException.class, () ->
|
||||||
0, false,
|
new NeuronSquareMesh2D(2, false,
|
||||||
SquareNeighbourhood.VON_NEUMANN,
|
0, false,
|
||||||
initArray);
|
SquareNeighbourhood.VON_NEUMANN,
|
||||||
|
initArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -887,4 +892,5 @@ public class NeuronSquareMesh2DTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue