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 d7dbe72..a021073 100644
--- a/src/genome/genome.test.js
+++ b/src/genome/genome.test.js
@@ -8,6 +8,7 @@ import {
mut_gene_weight,
mut_genome_expand,
mut_genome_insert,
+ mut_genome_delete,
} from './genome';
@@ -186,3 +187,27 @@ test('insert new genes', () => {
[[0, 2, -4], [2, 1, 4]]
]);
});
+
+
+test('remove genes', () => {
+ const n_input = 0;
+ const n_output = 0;
+ const n_internal = 3;
+ const genome = [
+ [0, 1, 0], [1, 2, 0],
+ ];
+
+ expect(mut_genome_delete([
+ n_input, n_internal, n_output, genome
+ ], 0.0)).toEqual([
+ n_input, n_internal, n_output,
+ [[1, 2, 0]],
+ ]);
+
+ expect(mut_genome_delete([
+ n_input, n_internal, n_output, genome
+ ], 0.99)).toEqual([
+ n_input, n_internal, n_output,
+ [[0, 1, 0]],
+ ]);
+});