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.78 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.77 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.76 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.75 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.74 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.73 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.72 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.71 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.70 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.69 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.68 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.67 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.66 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.65 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.64 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.63 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.62 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.61 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.60 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.59 tracks/javascript/exercises/hamming/hamming.spec.js