Created
February 1, 2012 01:02
-
-
Save yngwie74/1714297 to your computer and use it in GitHub Desktop.
Especificación para euler07.js en Jasmine
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
/*** | |
* Especificación para: | |
* - euler07.js (https://gist.github.com/1714307) | |
* | |
* requiere jasmine (http://tryjasmine.com/) | |
* | |
* https://gist.github.com/1714297 | |
***/ | |
describe("Euler07", function() { | |
describe("Primes less than 10", function() { | |
[ | |
false, false, true, true, false, | |
true, false, true, false, false | |
].forEach(function(result, number, a) { | |
it("finds isPrime(" + number + ") is " + result, function() { | |
expect(Euler07.isPrime(number)).toEqual(result); | |
}); | |
}); | |
}); | |
describe("First six prime numbers", function() { | |
[2, 3, 5, 7, 11, 13].forEach(function(nextPrime, i, a) { | |
it("yields getNthPrime(" + i + ") is " + nextPrime, function() { | |
var p = Euler07.getNthPrime(i+1); | |
expect(p).toEqual(nextPrime); | |
}); | |
}); | |
}); | |
it("yields getNthPrime(10001) is 104743", function() { | |
expect(Euler07.getNthPrime(10001)).toEqual(104743); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment