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.98 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.97 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.96 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.95 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.94 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.93 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.92 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.91 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.90 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.89 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.88 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.87 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.86 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.85 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.84 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.83 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.82 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.81 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.80 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.79 tracks/javascript/exercises/hamming/hamming.spec.js