From 4d937c07ef56a406565f8bc45f16e71257adbb6d Mon Sep 17 00:00:00 2001 From: seemcat Date: Sun, 4 Jun 2017 23:08:53 -0700 Subject: [PATCH 1/3] Test & Solution for #8 --- solutions/8a.js | 16 ++++++++++++++++ test/8a.js | 15 +++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 solutions/8a.js create mode 100644 test/8a.js diff --git a/solutions/8a.js b/solutions/8a.js new file mode 100644 index 0000000..09f5d35 --- /dev/null +++ b/solutions/8a.js @@ -0,0 +1,16 @@ +// Maricris Bonzo +// Create a function that returns a string in reverse. + +const solution = (string) => { + let indexLength = string.length - 1; + let reverseString = ''; + + for(i = 0; i <= indexLength; i++){ + reverseString = string[i] + reverseString; + } + return reverseString; +}; + +module.exports = { + solution +}; diff --git a/test/8a.js b/test/8a.js new file mode 100644 index 0000000..223cd12 --- /dev/null +++ b/test/8a.js @@ -0,0 +1,15 @@ +const expect = require('chai').expect; +let solution = require('../solutions/8a').solution; + +describe('reverse String', () => { + it('should return a string in reverse', () => { + const actual = "react"; + const expected = "tcaer"; + expect(solution(actual)).to.equal(expected); + }); + it('should return a string in reverse', () => { + const actual = "hello"; + const expected = "olleh"; + expect(solution(actual)).to.equal(expected); + }); +}); From 33f4991fb2b398bda183844d26a869715e638846 Mon Sep 17 00:00:00 2001 From: seemcat Date: Mon, 5 Jun 2017 11:26:13 -0700 Subject: [PATCH 2/3] Necessary Changes --- solutions/8.js | 13 +++++++++++++ solutions/8a.js | 16 ---------------- test/8.js | 6 ++++++ test/8a.js | 15 --------------- 4 files changed, 19 insertions(+), 31 deletions(-) delete mode 100644 solutions/8a.js delete mode 100644 test/8a.js diff --git a/solutions/8.js b/solutions/8.js index 16d6ed8..9328029 100644 --- a/solutions/8.js +++ b/solutions/8.js @@ -9,6 +9,19 @@ const solution = (string) => { return newString; }; +// Maricris Bonzo: seemcat + +const solution1 = (string) => { + let indexLength = string.length - 1; + let reverseString = ''; + + for(i = 0; i <= indexLength; i++){ + reverseString = string[i] + reverseString; + } + return reverseString; +}; + module.exports = { solution, + solution1 }; diff --git a/solutions/8a.js b/solutions/8a.js deleted file mode 100644 index 09f5d35..0000000 --- a/solutions/8a.js +++ /dev/null @@ -1,16 +0,0 @@ -// Maricris Bonzo -// Create a function that returns a string in reverse. - -const solution = (string) => { - let indexLength = string.length - 1; - let reverseString = ''; - - for(i = 0; i <= indexLength; i++){ - reverseString = string[i] + reverseString; - } - return reverseString; -}; - -module.exports = { - solution -}; diff --git a/test/8.js b/test/8.js index edb956b..61a4218 100644 --- a/test/8.js +++ b/test/8.js @@ -1,6 +1,12 @@ const expect = require('chai').expect; let solution = require('../solutions/8').solution; +<<<<<<< HEAD solution = require('../yourSolution').solution; +======= +let solution1 = require('../solutions/8').solution; + +// solution = require('./yourSolution').solution; +>>>>>>> Necessary Changes describe('reverse String', () => { it('should reverse a string in reverse', () => { diff --git a/test/8a.js b/test/8a.js deleted file mode 100644 index 223cd12..0000000 --- a/test/8a.js +++ /dev/null @@ -1,15 +0,0 @@ -const expect = require('chai').expect; -let solution = require('../solutions/8a').solution; - -describe('reverse String', () => { - it('should return a string in reverse', () => { - const actual = "react"; - const expected = "tcaer"; - expect(solution(actual)).to.equal(expected); - }); - it('should return a string in reverse', () => { - const actual = "hello"; - const expected = "olleh"; - expect(solution(actual)).to.equal(expected); - }); -}); From d3c2b16c453a28c3c8a564eba8ca7f0197843cc1 Mon Sep 17 00:00:00 2001 From: seemcat Date: Wed, 7 Jun 2017 07:57:37 -0700 Subject: [PATCH 3/3] Modified test file for #8 --- test/8.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/test/8.js b/test/8.js index 61a4218..b98b36f 100644 --- a/test/8.js +++ b/test/8.js @@ -1,12 +1,7 @@ const expect = require('chai').expect; let solution = require('../solutions/8').solution; -<<<<<<< HEAD -solution = require('../yourSolution').solution; -======= -let solution1 = require('../solutions/8').solution; - +let solution1 = require('../solutions/8').solution1; // solution = require('./yourSolution').solution; ->>>>>>> Necessary Changes describe('reverse String', () => { it('should reverse a string in reverse', () => { @@ -29,4 +24,25 @@ describe('reverse String', () => { const expected = "welcome emoclew"; expect(solution(actual)).to.equal(expected); }); + it('should reverse a string in reverse', () => { + const actual = "react"; + const expected = "tcaer"; + expect(solution1(actual)).to.equal(expected); + }); + it('should reverse a string in reverse', () => { + const actual = "word"; + const expected = "drow"; + expect(solution1(actual)).to.equal(expected); + }); + it('should reverse a string in reverse', () => { + const actual = "I"; + const expected = "I"; + expect(solution1(actual)).to.equal(expected); + }); + it('should reverse a string in reverse', () => { + const actual = "welcome emoclew"; + const expected = "welcome emoclew"; + expect(solution1(actual)).to.equal(expected); + }); + });