Last active
August 29, 2015 13:56
-
-
Save ericdouglas/8974497 to your computer and use it in GitHub Desktop.
Test and debug returning different values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('function that sum numbers between 1 and 100', function () { | |
var out = sum; | |
it('verify if the sum is correct', function () { | |
expect( out ).toBeDefined(); | |
expect( out() ).toBe( 5050 ); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var | |
count = 1, | |
limit = 100, | |
result = 0; | |
function sum () { | |
for ( ; count <= limit; count += 1 ) | |
result += count; | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment