Sha256: 942eb199a64088ec63c2b6f84445fa7677f2416493626b2fae7a3f6d8c3a1c9c

Contents?: true

Size: 1.09 KB

Versions: 208

Compression:

Stored size: 1.09 KB

Contents

import Hamming from './hamming';

describe('Hamming', () => {
  let hamming = new Hamming();

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

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

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

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

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

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

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

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

});

Version data entries

208 entries across 208 versions & 1 rubygems

Version Path
trackler-2.1.0.53 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.52 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.51 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.50 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.49 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.48 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.47 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.46 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.45 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.44 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.43 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.42 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.41 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.40 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.39 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.38 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.37 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.36 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.34 tracks/ecmascript/exercises/hamming/hamming.spec.js
trackler-2.1.0.33 tracks/ecmascript/exercises/hamming/hamming.spec.js