summaryrefslogtreecommitdiff
path: root/src/mind/topology.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/mind/topology.test.js')
-rw-r--r--src/mind/topology.test.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mind/topology.test.js b/src/mind/topology.test.js
index fbe1862..b272040 100644
--- a/src/mind/topology.test.js
+++ b/src/mind/topology.test.js
@@ -210,3 +210,23 @@ test('memory and input', () => {
[ Math.tanh( 2-1 ) ],
]);
});
+
+
+test('input and state must be the correct size', () => {
+ const n = network(2, 1, 1)
+ .connect(0, 2, 1)
+ .connect(1, 2, 1)
+ .connect(2, 3, 1);
+
+ // wrong input size
+ expect(() => n.compute([], [4])).toThrow();
+ expect(() => n.compute([1], [4])).toThrow();
+ expect(() => n.compute([1, 1, 1], [4])).toThrow();
+
+ // wrong state size
+ expect(() => n.compute([1, 1], [])).toThrow();
+ expect(() => n.compute([1, 1], [4, 4])).toThrow();
+
+ // prove correct sizes work
+ n.compute([1, 1], [4]);
+});