Skip to content

Commit

Permalink
#119 Ported primary auditory cortex test
Browse files Browse the repository at this point in the history
  • Loading branch information
filippomc committed Nov 8, 2019
1 parent 5cc7b3f commit b9b7913
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 3 deletions.
105 changes: 102 additions & 3 deletions __tests__/ModelFactory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,113 @@ test('load test model with new instances', () => {
GEPPETTO.Manager.loadModel(testModel);

expect(ModelFactory.allPaths.length).toBe(11);
expect(Instances.length).toBe(7)
expect(Instances.a.getValue().l[0]).toBe('x');
expect(Instances.b.getValue().expression).toBe('exp');
expect(Instances.b.getPosition().y).toBe(50);
expect(Instances.c.getValue().x.y.data).toBe('imageData');
expect(Instances.d.getValue().a.text).toBe('Test');
expect(Instances.d.getValue().b.url).toBe("http://aaa.com");
expect(Instances.d.getValue().c.x).toBe(1);
expect(Instances.E.getValue().value.length).toBe(3);
expect(Instances.getInstance('v.ctv').getValue().value.text).toBe('aaa');
expect(Instances.a2b.a).toBe(Instances.a);
expect(Instances.a2b.b).toBe(Instances.b);
ModelFactory.allPaths = [];
ModelFactory.allPathsIndexing = [];
});

test('load demo model 1', () => {
test('load demo model 1: Hodgkin-Huxley NEURON simulation', () => {
GEPPETTO.Manager.loadModel(require('./resources/model.1.json'));
// console.log(ModelFactory.allPaths);
expect(ModelFactory.allPaths.length).toBe(136);

Instances.getInstance('time');
expect(Instances.length).toBe(2);
ModelFactory.allPaths = [];
ModelFactory.allPathsIndexing = [];

});


test('load demo model 5: Primary auditory cortex network', () => {
GEPPETTO.Manager.loadModel(require('./resources/model.5.json'));
// console.log(ModelFactory.allPaths);


expect(ModelFactory.allPaths.length).toBe(13491);
expect(window.acnet2 != undefined && window.acnet2.baskets_12 != undefined)
.toBeTruthy();
expect(window.acnet2.pyramidals_48.getChildren().length === 48
&& window.acnet2.baskets_12.getChildren().length === 12)
.toBeTruthy()


expect(GEPPETTO.ModelFactory.resolve('//@libraries.1/@types.5').getId() == window.Model.getLibraries()[1].getTypes()[5].getId()
&& GEPPETTO.ModelFactory.resolve('//@libraries.1/@types.5').getMetaType() == window.Model.getLibraries()[1].getTypes()[5].getMetaType())
.toBeTruthy()

let acnet2 = window.acnet2;
expect(acnet2.baskets_12[0].getTypes().length == 1
&& acnet2.baskets_12[0].getTypes()[0].getId() == 'bask'
&& acnet2.baskets_12[0].getTypes()[0].getMetaType() == 'CompositeType')
.toBeTruthy()


expect(acnet2.baskets_12[0].getTypes()[0].getVisualType().getVisualGroups().length == 3
&& acnet2.baskets_12[0].getTypes()[0].getVisualType().getVisualGroups()[0].getId() == 'Cell_Regions'
&& (acnet2.baskets_12[0].getTypes()[0].getVisualType().getVisualGroups()[1].getId() == 'Kdr_bask'
|| acnet2.baskets_12[0].getTypes()[0].getVisualType().getVisualGroups()[1].getId() == 'Kdr_bask')
&& (acnet2.baskets_12[0].getTypes()[0].getVisualType().getVisualGroups()[2].getId() == 'Na_bask'
|| acnet2.baskets_12[0].getTypes()[0].getVisualType().getVisualGroups()[2].getId() == 'Na_bask'))
.toBeTruthy();

expect(GEPPETTO.ModelFactory.getAllInstancesOf(acnet2.baskets_12[0].getType()).length == 12
&& GEPPETTO.ModelFactory.getAllInstancesOf(acnet2.baskets_12[0].getType().getPath()).length == 12
&& GEPPETTO.ModelFactory.getAllInstancesOf(acnet2.baskets_12[0].getType())[0].getId() == "baskets_12[0]"
&& GEPPETTO.ModelFactory.getAllInstancesOf(acnet2.baskets_12[0].getType())[0].getMetaType() == "ArrayElementInstance")
.toBeTruthy()

expect(GEPPETTO.ModelFactory.getAllInstancesOf(acnet2.baskets_12[0].getVariable()).length == 1
&& GEPPETTO.ModelFactory.getAllInstancesOf(acnet2.baskets_12[0].getVariable().getPath()).length == 1
&& GEPPETTO.ModelFactory.getAllInstancesOf(acnet2.baskets_12[0].getVariable())[0].getId() == "baskets_12"
&& GEPPETTO.ModelFactory.getAllInstancesOf(acnet2.baskets_12[0].getVariable())[0].getMetaType() == "ArrayInstance")
.toBeTruthy()

expect(GEPPETTO.ModelFactory.allPathsIndexing.length ).toBe(9741)
expect(GEPPETTO.ModelFactory.allPathsIndexing[0].path ).toBe('acnet2')
expect( GEPPETTO.ModelFactory.allPathsIndexing[0].metaType ).toBe( 'CompositeType')
expect(GEPPETTO.ModelFactory.allPathsIndexing[9741 - 2].path).toBe( "acnet2.SmallNet_bask_bask.GABA_syn_inh.GABA_syn_inh")
expect(GEPPETTO.ModelFactory.allPathsIndexing[9741 - 1].metaType)
.toBe('StateVariableType')

expect(window.Instances.getInstance('acnet2.baskets_12[3]').getInstancePath() == 'acnet2.baskets_12[3]')
.toBeTruthy()


expect(window.Instances.getInstance('acnet2.baskets_12[3].soma_0.v').getInstancePath() == 'acnet2.baskets_12[3].soma_0.v')
.toBeTruthy()


expect(window.Instances.getInstance('acnet2.baskets_12[3].sticaxxi') == undefined)
.toBeTruthy()


expect(window.acnet2.baskets_12[0].hasCapability(GEPPETTO.Resources.VISUAL_CAPABILITY))
.toBeTruthy()


expect(window.acnet2.baskets_12[0].getType().hasCapability(GEPPETTO.Resources.VISUAL_CAPABILITY))
.toBeTruthy()


expect(window.Model.neuroml.network_ACnet2.temperature.hasCapability(GEPPETTO.Resources.PARAMETER_CAPABILITY))
.toBeTruthy()

expect(GEPPETTO.ModelFactory.getAllVariablesOfMetaType(GEPPETTO.ModelFactory.getAllTypesOfMetaType(GEPPETTO.Resources.COMPOSITE_TYPE_NODE),
'ConnectionType')[0].hasCapability(GEPPETTO.Resources.CONNECTION_CAPABILITY))
.toBeTruthy()

expect(window.acnet2.pyramidals_48[0].getConnections()[0].hasCapability(GEPPETTO.Resources.CONNECTION_CAPABILITY))
.toBeTruthy()
ModelFactory.allPaths = [];

});
1 change: 1 addition & 0 deletions __tests__/resources/model.5.json

Large diffs are not rendered by default.

0 comments on commit b9b7913

Please sign in to comment.