Sha256: 1f4c74d04a6cf55c057a7b1f087b203c58bdff194b19cee7d39a3afb8b7f2395

Contents?: true

Size: 1.16 KB

Versions: 141

Compression:

Stored size: 1.16 KB

Contents

var Hamming = require('./hamming');

describe('Hamming', function () {
  var hamming = new Hamming();

  it('no difference between identical strands', function () {
    expect(hamming.compute('A', 'A')).toEqual(0);
  });

  xit('complete hamming distance for single nucleotide strand', function () {
    expect(hamming.compute('A', 'G')).toEqual(1);
  });

  xit('complete hamming distance for small strand', function () {
    expect(hamming.compute('AG', 'CT')).toEqual(2);
  });

  xit('small hamming distance', function () {
    expect(hamming.compute('AT', 'CT')).toEqual(1);
  });

  xit('small hamming distance in longer strand', function () {
    expect(hamming.compute('GGACG', 'GGTCG')).toEqual(1);
  });

  xit('large hamming distance', function () {
    expect(hamming.compute('GATACA', 'GCATAA')).toEqual(4);
  });

  xit('hamming distance in very long strand', function () {
    expect(hamming.compute('GGACGGATTCTG', 'AGGACGGATTCT')).toEqual(9);
  });

  xit('throws error when strands are not equal length', function () {
    expect(function () { hamming.compute('GGACGGATTCTG', 'AGGAC'); }).toThrow(
      new Error('DNA strands must be of equal length.')
    );
  });
});

Version data entries

141 entries across 141 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.138 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.137 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.136 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.135 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.134 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.133 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.132 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.131 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.130 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.129 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.128 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.127 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.126 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.125 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.124 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.123 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.122 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.121 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.120 tracks/javascript/exercises/hamming/hamming.spec.js