Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasMolzberger committed Jan 12, 2025
1 parent 4c38c78 commit 045c627
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static network.aika.activations.TestBSTypes.A;
import static network.aika.activations.TestBSTypes.B;
import static network.aika.activations.TestUtils.getInputLink;
import static network.aika.bindingsignal.Transition.of;
import static network.aika.neurons.RefType.NEURON_EXTERNAL;

Expand Down Expand Up @@ -46,7 +47,8 @@ public void init() {

inputNodeDef.neuron.initFlattenedType();
inputNodeDef.activation.initFlattenedType();
synapseDefinition.initFlattenedType();
firstInputEdgeDef.synapse.initFlattenedType();
firstInputEdgeDef.link.initFlattenedType();

inputNeuron = inputNodeDef.neuron.instantiate(model);
synapse = (ConjunctiveSynapse) synapseDefinition.instantiate(inputNeuron, neuron);
Expand All @@ -58,16 +60,16 @@ public void testLinkIncoming() {

Activation iAct = inputNeuron.createActivation(null, doc, Map.of(A, bs0));
Activation oAct = neuron.createActivation(null, doc, Map.of(B, bs0));
/*
Assertions.assertNull(oAct.getInputLink(iAct, 0));

Assertions.assertNull(getInputLink(oAct, 0));

bs0.addActivation(iAct);

Assertions.assertNull(oAct.getInputLink(iAct, 0));
Assertions.assertNull(getInputLink(oAct, 0));

oAct.linkIncoming(null);

Assertions.assertNotNull(oAct.getInputLink(iAct, 0));
*/
Assertions.assertEquals(iAct, getInputLink(oAct, 0).getInput());

}
}
11 changes: 11 additions & 0 deletions core/src/test/java/network/aika/activations/TestUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package network.aika.activations;

public class TestUtils {

public static Link getInputLink(Activation oAct, int synId) {
return oAct.getInputLinks()
.filter(l -> l.getSynapse().getSynapseId() == synId)
.findAny()
.orElse(null);
}
}

0 comments on commit 045c627

Please sign in to comment.