From 17fc9fe64f4de1bc58596034c54ddb487f992c9f Mon Sep 17 00:00:00 2001 From: sanine Date: Mon, 30 Oct 2023 01:00:53 -0500 Subject: add mut_genome_delete --- src/genome/genome.test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/genome/genome.test.js') 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]], + ]); +}); -- cgit v1.2.1