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.58 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.57 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.56 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.55 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.54 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.53 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.52 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.51 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.50 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.49 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.48 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.47 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.46 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.45 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.44 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.43 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.42 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.41 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.40 tracks/javascript/exercises/hamming/hamming.spec.js
trackler-2.2.1.39 tracks/javascript/exercises/hamming/hamming.spec.js