Sha256: dcb55d73de55fd6cc08afd0cb70beb4eeb8eed14e47abc782c3f24fc696f3b4f

Contents?: true

Size: 1011 Bytes

Versions: 132

Compression:

Stored size: 1011 Bytes

Contents

var CollatzConjecture = require('./collatz-conjecture');

describe('CollatzConjecture', function () {
  var collatz = new CollatzConjecture();

  it('test zero steps for one', function () {
    var expected = 0;
    expect(collatz.steps(1)).toEqual(expected);
  });

  xit('test divide if even steps', function () {
    var expected = 4;
    expect(collatz.steps(16)).toEqual(expected);
  });

  xit('test even and odd steps', function () {
    var expected = 9;
    expect(collatz.steps(12)).toEqual(expected);
  });

  xit('test large number of even and odd steps', function () {
    var expected = 152;
    expect(collatz.steps(1000000)).toEqual(expected);
  });

  xit('test zero is an error', function () {
    expect(function () {
      collatz.steps(0);
    }).toThrow(new Error('Only positive numbers are allowed'));
  });

  xit('test negative value is an error', function () {
    expect(function () {
      collatz.steps(-1);
    }).toThrow(new Error('Only positive numbers are allowed'));
  });
});

Version data entries

132 entries across 132 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.77 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.76 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.75 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.74 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.73 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.72 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.71 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.70 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.69 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.68 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.67 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.66 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.65 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.64 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.63 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.62 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.61 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.60 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js
trackler-2.2.1.59 tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js