}
public void testSetPreset() {
float tolerance = 1e-10f;
IzhikevichSpikeGenerator sg = new IzhikevichSpikeGenerator(IzhikevichSpikeGenerator.Preset.DEFAULT);
TestUtil.assertClose(.02f, sg.getA(), tolerance);
TestUtil.assertClose(.2f, sg.getB(), tolerance);
TestUtil.assertClose(-65f, sg.getC(), tolerance);
TestUtil.assertClose(2f, sg.getD(), tolerance);
sg.setPreset(IzhikevichSpikeGenerator.Preset.CHATTERING);
TestUtil.assertClose(-50f, sg.getC(), tolerance);
sg.setPreset(IzhikevichSpikeGenerator.Preset.RESONATOR);
TestUtil.assertClose(.1f, sg.getA(), tolerance);
TestUtil.assertClose(.26f, sg.getB(), tolerance);
TestUtil.assertClose(-65f, sg.getC(), tolerance);
sg.setA(.05f);
assertTrue(sg.getPreset() == IzhikevichSpikeGenerator.Preset.CUSTOM);
TestUtil.assertClose(.05f, sg.getA(), tolerance);
}