From ada67f8649d91a058e0eb7f9ec6208ad96a2a3bd Mon Sep 17 00:00:00 2001 From: Alvin Kristanto Date: Wed, 25 Oct 2017 13:03:22 +0700 Subject: [PATCH] feat(seed): Added more assertion for problem twenty eight (#15913) --- .../project-euler-problems.json | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 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 a6ed1db374..8b6468e922 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 @@ -872,26 +872,30 @@ "type": "bonfire", "title": "Problem 28: Number spiral diagonals", "tests": [ - "assert.strictEqual(euler28(), 669171001, 'message: euler28() should return 669171001.');" + "assert(spiralDiagonals(101) == 692101, 'message: spiralDiagonals(101) should return 692101.');", + "assert(spiralDiagonals(303) == 18591725, 'message: spiralDiagonals(303) should return 18591725.');", + "assert(spiralDiagonals(505) == 85986601, 'message: spiralDiagonals(505) should return 85986601.');", + "assert(spiralDiagonals(1001) == 669171001, 'message: spiralDiagonals(1001) should return 669171001.');" ], "solutions": [], "translations": {}, "challengeSeed": [ - "function euler28() {", + "function spiralDiagonals(n) {", " // Good luck!", - " return true;", + " return n;", "}", "", - "euler28();" + "spiralDiagonals(1001);" ], "description": [ "Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:", "21 22 23 24 25", "20  7  8  9 10", "19  6  1  2 11", - "18  5  4  3 1217 16 15 14 13", + "18  5  4  3 12", + "17 16 15 14 13", "It can be verified that the sum of the numbers on the diagonals is 101.", - "What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?" + "What is the sum of the numbers on the diagonals in a n by n spiral formed in the same way?" ] }, {