summaryrefslogtreecommitdiff
path: root/src/genome/genome.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/genome/genome.test.js')
-rw-r--r--src/genome/genome.test.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/genome/genome.test.js b/src/genome/genome.test.js
index 11b2d31..d7dbe72 100644
--- a/src/genome/genome.test.js
+++ b/src/genome/genome.test.js
@@ -7,6 +7,7 @@ import {
mut_gene_sink,
mut_gene_weight,
mut_genome_expand,
+ mut_genome_insert,
} from './genome';
@@ -161,3 +162,27 @@ test('expand genome', () => {
],
]);
});
+
+
+test('insert new genes', () => {
+ const n_input = 1;
+ const n_internal = 2;
+ const n_output = 1;
+ const weight_max = 4;
+
+ expect(mut_genome_insert([
+ n_input, n_internal, n_output,
+ []
+ ], weight_max, 0, 0.5, 0)).toEqual([
+ n_input, n_internal, n_output,
+ [[0, 2, -4]]
+ ]);
+
+ expect(mut_genome_insert([
+ n_input, n_internal, n_output,
+ [[0, 2, -4]]
+ ], weight_max, 0.99, 0, 1)).toEqual([
+ n_input, n_internal, n_output,
+ [[0, 2, -4], [2, 1, 4]]
+ ]);
+});