From 04cf144c9fe3507c593ce4fdfc8f4fe059345f23 Mon Sep 17 00:00:00 2001 From: Alvin Kristanto Date: Tue, 31 Oct 2017 04:25:39 +0700 Subject: [PATCH] feat(seed): Added more assertions for Project Euler (#16057) --- .../project-euler-problems.json | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json b/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json index 1781d29fc6..82b614a75f 100644 --- a/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json +++ b/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json @@ -1139,21 +1139,24 @@ "type": "bonfire", "title": "Problem 37: Truncatable primes", "tests": [ - "assert.strictEqual(euler37(), 748317, 'message: euler37() should return 748317.');" + "assert(truncatablePrimes(8) == 1986, 'message: truncatablePrimes(8) should return 1986.');", + "assert(truncatablePrimes(9) == 5123, 'message: truncatablePrimes(9) should return 5123.');", + "assert(truncatablePrimes(10) == 8920, 'message: truncatablePrimes(10) should return 8920.');", + "assert(truncatablePrimes(11) == 748317, 'message: truncatablePrimes(11) should return 748317.');" ], "solutions": [], "translations": {}, "challengeSeed": [ - "function euler37() {", + "function truncatablePrimes(n) {", " // Good luck!", - " return true;", + " return n;", "}", "", - "euler37();" + "truncatablePrimes(11);" ], "description": [ "The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3.", - "Find the sum of the only eleven primes that are both truncatable from left to right and right to left.", + "Find the sum of the only n (8 <= n <= 11) primes that are both truncatable from left to right and right to left.", "NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes." ] },