Revert "remove class based exercises"

This reverts commit 290e7f1da4.
This commit is contained in:
Cody Loyd
2017-11-24 14:23:16 -06:00
parent 4d1f419b41
commit 829730fb79
18 changed files with 164 additions and 67 deletions
+2 -17
View File
@@ -1,20 +1,5 @@
var sumAll = function(a, b) {
if (a > b) {
let temp = a
a = b
b = temp
}
if (
a < 0 || b < 0 ||
typeof a != 'number' || typeof b != 'number'
) {
return 'ERROR'
}
let sum = 0
for(let i = a; i < b + 1; i++) {
sum += i
}
return sum
var sumAll = function() {
}
module.exports = sumAll
+5 -5
View File
@@ -4,19 +4,19 @@ describe('sumAll', function() {
it('sums numbers within the range', function() {
expect(sumAll(1, 4)).toEqual(10);
});
it('works with large numbers', function() {
xit('works with large numbers', function() {
expect(sumAll(1, 4000)).toEqual(8002000);
});
it('works with larger number first', function() {
xit('works with larger number first', function() {
expect(sumAll(123, 1)).toEqual(7626);
});
it('returns ERROR with negative numbers', function() {
xit('returns ERROR with negative numbers', function() {
expect(sumAll(-10, 4)).toEqual('ERROR');
});
it('returns ERROR with non-number parameters', function() {
xit('returns ERROR with non-number parameters', function() {
expect(sumAll(10, "90")).toEqual('ERROR');
});
it('returns ERROR with non-number parameters', function() {
xit('returns ERROR with non-number parameters', function() {
expect(sumAll(10, [90, 1])).toEqual('ERROR');
});
});