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.38 tracks/javascript/exercises/hamming/hamming.spec.js