소스 검색

Merge pull request #1044 from bmkiefer/reverse-string-add-to-track

reverse-string: add to track
Logan Stucki 8 년 전
부모
커밋
d583c95b23
No account linked to committer's email

+ 10
- 0
config.json 파일 보기

@@ -25,6 +25,16 @@
25 25
     },
26 26
     {
27 27
       "core": false,
28
+      "difficulty": 1,
29
+      "slug": "reverse-string",
30
+      "topics": [
31
+        "strings"
32
+      ],
33
+      "unlocked_by": null,
34
+      "uuid": "2c8afeed-480e-41f3-ad58-590fa8f88029"
35
+    },
36
+    {
37
+      "core": false,
28 38
       "difficulty": 2,
29 39
       "slug": "rna-transcription",
30 40
       "topics": [

+ 7
- 0
exercises/reverse-string/.meta/src/reference/java/ReverseString.java 파일 보기

@@ -0,0 +1,7 @@
1
+class ReverseString {
2
+  
3
+    String reverse(String inputString) {
4
+        return new StringBuffer(inputString).reverse().toString();
5
+    }
6
+  
7
+}

+ 1
- 0
exercises/reverse-string/.meta/version 파일 보기

@@ -0,0 +1 @@
1
+1.0.1

+ 25
- 0
exercises/reverse-string/README.md 파일 보기

@@ -0,0 +1,25 @@
1
+# reverse-string
2
+
3
+Reverse a string
4
+
5
+For example:
6
+input: "cool"
7
+output: "looc"
8
+
9
+# Running the tests
10
+
11
+You can run all the tests for an exercise by entering
12
+
13
+```sh
14
+$ gradle test
15
+```
16
+
17
+in your terminal.
18
+
19
+## Source
20
+
21
+Introductory challenge to reverse an input string [https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb](https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb)
22
+
23
+## Submitting Incomplete Solutions
24
+
25
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.

+ 17
- 0
exercises/reverse-string/build.gradle 파일 보기

@@ -0,0 +1,17 @@
1
+apply plugin: "java"
2
+apply plugin: "eclipse"
3
+apply plugin: "idea"
4
+
5
+repositories {
6
+    mavenCentral()
7
+}
8
+
9
+dependencies {
10
+    testCompile "junit:junit:4.12"
11
+}
12
+test {
13
+    testLogging {
14
+        exceptionFormat = 'full'
15
+        events = ["passed", "failed", "skipped"]
16
+    }
17
+}

+ 7
- 0
exercises/reverse-string/src/main/java/ReverseString.java 파일 보기

@@ -0,0 +1,7 @@
1
+class ReverseString {
2
+  
3
+    String reverse() {
4
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
5
+    }
6
+  
7
+}

+ 37
- 0
exercises/reverse-string/src/test/java/ReverseStringTest.java 파일 보기

@@ -0,0 +1,37 @@
1
+import org.junit.Ignore;
2
+import org.junit.Test;
3
+
4
+import static org.junit.Assert.assertEquals;
5
+
6
+public class ReverseStringTest {
7
+
8
+    @Test
9
+    public void testAnEmptyString() {
10
+        assertEquals("", new ReverseString().reverse(""));
11
+    }
12
+
13
+    @Ignore("Remove to run test")
14
+    @Test
15
+    public void testAWord() {
16
+        assertEquals("tobor", new ReverseString().reverse("robot"));
17
+    }
18
+
19
+    @Ignore("Remove to run test")
20
+    @Test
21
+    public void testACapitalizedWord() {
22
+        assertEquals("nemaR", new ReverseString().reverse("Ramen"));
23
+    }
24
+
25
+    @Ignore("Remove to run test")
26
+    @Test
27
+    public void testASentenceWithPunctuation() {
28
+        assertEquals("!yrgnuh m'I", new ReverseString().reverse("I'm hungry!"));
29
+    }
30
+
31
+    @Ignore("Remove to run test")
32
+    @Test
33
+    public void testAPalindrome() {
34
+        assertEquals("racecar", new ReverseString().reverse("racecar"));
35
+    }
36
+
37
+}

+ 1
- 0
exercises/settings.gradle 파일 보기

@@ -59,6 +59,7 @@ include 'pythagorean-triplet'
59 59
 include 'queen-attack'
60 60
 include 'raindrops'
61 61
 include 'rectangles'
62
+include 'reverse-string'
62 63
 include 'rna-transcription'
63 64
 include 'robot-name'
64 65
 include 'robot-simulator'