trackler 2.2.1.23 → 2.2.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7eeeb06b8a86deac0f26302dd74e241e7d596ed
4
- data.tar.gz: 5d9a37663a0b4e73d9f2a4641a49779f53e7942e
3
+ metadata.gz: e2e283263dcb2b1b96c11ff97fa2844e01c19df1
4
+ data.tar.gz: a2ebd562fbf6a39ada3dcea45990ab8fedbec803
5
5
  SHA512:
6
- metadata.gz: 46d57019c6934b15386420eba7ad0292f6785276b68537b4b3ceee85f3e0e972d2c98a64c044aba34bf72668972071179d5081018cf59968f2b0646ef4ae4d81
7
- data.tar.gz: cea6e2ba9138a5117ddd1f834119d8d1df3b0c232f7d4ce303ef7eeaf35390fc31fc339cdcb7355e76259342bba0d35089ec944e9baca9b4ed997c2878dfa143
6
+ metadata.gz: 18426e7ef2149223d71a08d059a09d6210218ed2ec2d267cc734dd0a1938228b8109d040c9cd66d6110bcd1fbfd92c7d8e6e16227a4194f3823bae9b8fd87195
7
+ data.tar.gz: b3165e421be7d3de9cab754e295f539d8a1e7c86941e7cddfd6735847391922dadd6d0aa59d541b650c32479eb117deff4a8083eda304c21227fa45d237965da
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.23"
2
+ VERSION = "2.2.1.24"
3
3
  end
@@ -0,0 +1,5 @@
1
+ class HelloWorld
2
+ def self.hello(name = "World")
3
+ "Hello, #{name}!"
4
+ end
5
+ end
@@ -7,11 +7,11 @@ namespace Generators
7
7
  {
8
8
  public abstract class Exercise
9
9
  {
10
+ public string Name => GetType().ToExerciseName();
11
+
10
12
  private static readonly ExerciseWriter ExerciseWriter = new ExerciseWriter();
11
13
  private CanonicalData _canonicalData { get; set; }
12
14
 
13
- public string Name => GetType().ToExerciseName();
14
-
15
15
  public void Regenerate(CanonicalData canonicalData)
16
16
  {
17
17
  _canonicalData = canonicalData;
@@ -20,42 +20,58 @@ namespace Generators
20
20
  ExerciseWriter.WriteToFile(this);
21
21
  }
22
22
 
23
+ public string Render() => CreateTestClass().Render();
24
+
23
25
  protected virtual void UpdateCanonicalData(CanonicalData canonicalData)
24
26
  {
25
27
  }
26
28
 
27
- public virtual string Render() => CreateTestClass().Render();
28
-
29
- protected virtual TestClass CreateTestClass() => new TestClass
29
+ protected virtual HashSet<string> AddAdditionalNamespaces()
30
30
  {
31
- ClassName = Name.ToTestClassName(),
32
- Methods = RenderTestMethods(),
33
- CanonicalDataVersion = _canonicalData.Version,
34
- UsingNamespaces = GetUsingNamespaces()
35
- };
31
+ return new HashSet<string>();
32
+ }
33
+
34
+ protected virtual string RenderTestMethodBodyArrange(TestMethodBody testMethodBody)
35
+ => TemplateRenderer.RenderPartial(testMethodBody.ArrangeTemplateName, testMethodBody.ArrangeTemplateParameters);
36
+
37
+ protected virtual string RenderTestMethodBodyAct(TestMethodBody testMethodBody)
38
+ => TemplateRenderer.RenderPartial(testMethodBody.ActTemplateName, testMethodBody.ActTemplateParameters);
39
+
40
+ protected virtual string RenderTestMethodBodyAssert(TestMethodBody testMethodBody)
41
+ => TemplateRenderer.RenderPartial(testMethodBody.AssertTemplateName, testMethodBody.AssertTemplateParameters);
36
42
 
37
- protected virtual HashSet<string> GetUsingNamespaces()
43
+ private HashSet<string> GetUsingNamespaces()
38
44
  {
39
45
  var usingNamespaces = new HashSet<string> { "Xunit" };
40
46
 
41
47
  foreach (var canonicalDataCase in _canonicalData.Cases.Where(canonicalDataCase => canonicalDataCase.ExceptionThrown != null))
42
48
  usingNamespaces.Add(canonicalDataCase.ExceptionThrown.Namespace);
43
49
 
50
+ usingNamespaces.UnionWith(AddAdditionalNamespaces());
51
+
44
52
  return usingNamespaces;
45
53
  }
46
54
 
47
- protected virtual string[] RenderTestMethods() => _canonicalData.Cases.Select(RenderTestMethod).ToArray();
55
+ private string[] RenderTestMethods() => _canonicalData.Cases.Select(RenderTestMethod).ToArray();
56
+
57
+ private TestClass CreateTestClass() => new TestClass
58
+ {
59
+ ClassName = Name.ToTestClassName(),
60
+ Methods = RenderTestMethods(),
61
+ CanonicalDataVersion = _canonicalData.Version,
62
+ UsingNamespaces = GetUsingNamespaces()
63
+ };
48
64
 
49
- protected virtual string RenderTestMethod(CanonicalDataCase canonicalDataCase, int index) => CreateTestMethod(canonicalDataCase, index).Render();
65
+ private string RenderTestMethod(CanonicalDataCase canonicalDataCase, int index) => CreateTestMethod(canonicalDataCase, index).Render();
50
66
 
51
- protected virtual TestMethod CreateTestMethod(CanonicalDataCase canonicalDataCase, int index) => new TestMethod
67
+ private TestMethod CreateTestMethod(CanonicalDataCase canonicalDataCase, int index) => new TestMethod
52
68
  {
53
69
  Skip = index > 0,
54
70
  Name = canonicalDataCase.Description.ToTestMethodName(),
55
71
  Body = RenderTestMethodBody(canonicalDataCase)
56
72
  };
57
73
 
58
- protected virtual string RenderTestMethodBody(CanonicalDataCase canonicalDataCase)
74
+ private string RenderTestMethodBody(CanonicalDataCase canonicalDataCase)
59
75
  {
60
76
  var testMethodBody = CreateTestMethodBody(canonicalDataCase);
61
77
  testMethodBody.Arrange = RenderTestMethodBodyArrange(testMethodBody);
@@ -65,7 +81,7 @@ namespace Generators
65
81
  return testMethodBody.Render();
66
82
  }
67
83
 
68
- protected virtual TestMethodBody CreateTestMethodBody(CanonicalDataCase canonicalDataCase)
84
+ private TestMethodBody CreateTestMethodBody(CanonicalDataCase canonicalDataCase)
69
85
  {
70
86
  if (canonicalDataCase.ExceptionThrown != null)
71
87
  {
@@ -84,14 +100,5 @@ namespace Generators
84
100
 
85
101
  return new TestMethodBodyWithEqualityCheck(canonicalDataCase, _canonicalData);
86
102
  }
87
-
88
- protected virtual string RenderTestMethodBodyArrange(TestMethodBody testMethodBody)
89
- => TemplateRenderer.RenderPartial(testMethodBody.ArrangeTemplateName, testMethodBody.ArrangeTemplateParameters);
90
-
91
- protected virtual string RenderTestMethodBodyAct(TestMethodBody testMethodBody)
92
- => TemplateRenderer.RenderPartial(testMethodBody.ActTemplateName, testMethodBody.ActTemplateParameters);
93
-
94
- protected virtual string RenderTestMethodBodyAssert(TestMethodBody testMethodBody)
95
- => TemplateRenderer.RenderPartial(testMethodBody.AssertTemplateName, testMethodBody.AssertTemplateParameters);
96
103
  }
97
104
  }
@@ -21,12 +21,12 @@ namespace Generators.Exercises
21
21
  }
22
22
  }
23
23
 
24
- protected override HashSet<string> GetUsingNamespaces()
24
+ protected override HashSet<string> AddAdditionalNamespaces()
25
25
  {
26
- var usingNamespaces = base.GetUsingNamespaces();
27
- usingNamespaces.Add(typeof(Dictionary<char, int>).Namespace);
28
-
29
- return usingNamespaces;
26
+ return new HashSet<string>()
27
+ {
28
+ typeof(Dictionary<char, int>).Namespace
29
+ };
30
30
  }
31
31
  }
32
32
  }
@@ -62,17 +62,17 @@ namespace Generators.Exercises
62
62
 
63
63
  private static string RenderComplexNumberAssert(TestMethodBody testMethodBody)
64
64
  {
65
- var tmeplate = "Assert.Equal({{ ExpectedParameter }}.Real(), {{ TestedValue }}.Real(), 15);\r\nAssert.Equal({{ ExpectedParameter }}.Imaginary(), {{ TestedValue }}.Imaginary(), 15);";
65
+ var template = "Assert.Equal({{ ExpectedParameter }}.Real(), {{ TestedValue }}.Real(), 15);\r\nAssert.Equal({{ ExpectedParameter }}.Imaginary(), {{ TestedValue }}.Imaginary(), 15);";
66
66
 
67
- return TemplateRenderer.RenderInline(tmeplate, testMethodBody.AssertTemplateParameters);
67
+ return TemplateRenderer.RenderInline(template, testMethodBody.AssertTemplateParameters);
68
68
  }
69
69
 
70
- protected override HashSet<string> GetUsingNamespaces()
70
+ protected override HashSet<string> AddAdditionalNamespaces()
71
71
  {
72
- var usingNamespaces = base.GetUsingNamespaces();
73
- usingNamespaces.Add(typeof(Math).Namespace);
74
-
75
- return usingNamespaces;
72
+ return new HashSet<string>()
73
+ {
74
+ typeof(Math).Namespace
75
+ };
76
76
  }
77
77
 
78
78
  private object ConvertToType(object rawValue)
@@ -20,12 +20,12 @@ namespace Generators.Exercises
20
20
  }
21
21
  }
22
22
 
23
- protected override HashSet<string> GetUsingNamespaces()
23
+ protected override HashSet<string> AddAdditionalNamespaces()
24
24
  {
25
- var usingNamespaces = base.GetUsingNamespaces();
26
- usingNamespaces.Add(typeof(DateTime).Namespace);
27
-
28
- return usingNamespaces;
25
+ return new HashSet<string>()
26
+ {
27
+ typeof(DateTime).Namespace
28
+ };
29
29
  }
30
30
 
31
31
  private string FormatDateTime(DateTime dateTime)
@@ -16,12 +16,12 @@ namespace Generators.Exercises
16
16
  }
17
17
  }
18
18
 
19
- protected override HashSet<string> GetUsingNamespaces()
19
+ protected override HashSet<string> AddAdditionalNamespaces()
20
20
  {
21
- var usingNamespaces = base.GetUsingNamespaces();
22
- usingNamespaces.Add(typeof(Dictionary<string, int>).Namespace);
23
-
24
- return usingNamespaces;
21
+ return new HashSet<string>()
22
+ {
23
+ typeof(Dictionary<string, int>).Namespace
24
+ };
25
25
  }
26
26
  }
27
27
  }
@@ -7,7 +7,7 @@ namespace Generators.Output
7
7
  public string ClassName { get; set; }
8
8
  public string CanonicalDataVersion { get; set; }
9
9
  public IList<string> Methods { get; set; }
10
- public ISet<string> UsingNamespaces { get; set; } = new HashSet<string> { "Xunit" };
10
+ public ISet<string> UsingNamespaces { get; set; }
11
11
  public string TemplateName { get; set; } = "TestClass";
12
12
 
13
13
  public string Render() => TemplateRenderer.RenderPartial(TemplateName, new { ClassName, CanonicalDataVersion, Methods, UsingNamespaces });
@@ -45,7 +45,11 @@ Please keep the following in mind:
45
45
 
46
46
  - Please open an issue before creating a PR that makes significant (breaking) changes to an existing exercise or makes changes across many exercises. It is best to discuss these changes before doing the work. Discussions related to exercises that are not track specific can be found in [exercism/discussions](https://github.com/exercism/discussions/issues).
47
47
 
48
- - Follow the coding standards for Dart. (If there is a formatter for the track's language, add instructions for using it here.)
48
+ - Follow the coding standards for Dart.
49
+ * For your convenience, [a link to the Dart style guide](https://www.dartlang.org/guides/language/effective-dart)
50
+ * Some points of interest:
51
+ * [Filename naming convention](https://www.dartlang.org/guides/language/effective-dart/style#do-name-libraries-and-source-files-using-lowercase_with_underscores)
52
+ * [Guide to the built-in formatter tool](https://github.com/dart-lang/dart_style#getting-dartfmt)
49
53
 
50
54
  - Watch out for trailing spaces, extra blank lines, and spaces in blank lines.
51
55
 
@@ -12,40 +12,40 @@ Choose your operating system:
12
12
 
13
13
  1. Open a Command Prompt.
14
14
 
15
- 2. Get the first exercise:
15
+ 1. Get the first exercise:
16
16
 
17
- ```batchfile
18
- exercism fetch dart
17
+ ```batchfile
18
+ C:\Users\JaneDoe>exercism fetch dart
19
19
 
20
- Not Submitted: 1 problem
21
- dart (Hello World) C:\Users\JohnDoe\exercism\dart\hello-world
20
+ Not Submitted: 1 problem
21
+ dart (Hello World) C:\Users\JaneDoe\exercism\dart\hello-world
22
22
 
23
- New: 1 problem
24
- dart (Hello World) C:\Users\JohnDoe\exercism\dart\hello-world
23
+ New: 1 problem
24
+ dart (Hello World) C:\Users\JaneDoe\exercism\dart\hello-world
25
25
 
26
- unchanged: 0, updated: 0, new: 1
27
- ```
26
+ unchanged: 0, updated: 0, new: 1
27
+ ```
28
28
 
29
- 3. Change directory into the exercism:
29
+ 1. Change directory into the exercism:
30
30
 
31
- ```batchfile
32
- C:\Users\JohnDoe>cd C:\Users\JohnDoe\exercism\dart\hello-world
33
- ```
31
+ ```batchfile
32
+ C:\Users\JaneDoe>cd C:\Users\JaneDoe\exercism\dart\hello-world
33
+ ```
34
34
 
35
- 4. Download the dependent packages:
35
+ 1. Download the dependent packages:
36
36
 
37
- ```batchfile
38
- C:\Users\JohnDoe>pub get
39
- ```
37
+ ```batchfile
38
+ C:\Users\JaneDoe>pub get
39
+ ```
40
40
 
41
- 5. Run the tests:
41
+ 1. Run the tests:
42
42
 
43
- ```batchfile
44
- C:\Users\JohnDoe>pub run test
45
- ```
43
+ ```batchfile
44
+ C:\Users\JaneDoe>pub run test
45
+ ```
46
46
  *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
47
47
 
48
- 6. Solve the exercise. Find and work through the `README.md` guide ([view on GitHub](https://github.com/exercism/dart/blob/master/exercises/hello-world/README.md)).
48
+ 1. Solve the exercise. Find and work through the `README.md` guide ([view on GitHub](https://github.com/exercism/dart/blob/master/exercises/hello-world/README.md)).
49
49
 
50
50
 
51
51
  Good luck! Have fun!
@@ -58,35 +58,35 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
58
58
 
59
59
  1. In the terminal window, get the first exercise:
60
60
 
61
- ```batchfile
62
- $ exercism fetch dart
61
+ ```shell
62
+ $ exercism fetch dart
63
63
 
64
- New: 1 problem
65
- Dart (Etl) /Users/johndoe/exercism/dart/hello-world
64
+ New: 1 problem
65
+ Dart (Etl) /Users/janedoe/exercism/dart/hello-world
66
66
 
67
- unchanged: 0, updated: 0, new: 1
68
- ```
67
+ unchanged: 0, updated: 0, new: 1
68
+ ```
69
69
 
70
- 2. Change directory into the exercise:
70
+ 1. Change directory into the exercise:
71
71
 
72
- ```batchfile
73
- $ cd /Users/johndoe/exercism/dart/hello-world
74
- ```
72
+ ```shell
73
+ $ cd /Users/janedoe/exercism/dart/hello-world
74
+ ```
75
75
 
76
- 3. Download the dependent packages:
76
+ 1. Download the dependent packages:
77
77
 
78
- ```batchfile
79
- $ pub get
80
- ```
78
+ ```shell
79
+ $ pub get
80
+ ```
81
81
 
82
- 4. Run the tests:
82
+ 1. Run the tests:
83
83
 
84
- ```batchfile
85
- $ pub run test
86
- ```
84
+ ```shell
85
+ $ pub run test
86
+ ```
87
87
  *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
88
88
 
89
- 6. Solve the exercise. Find and work through the `README.md` guide ([view on GitHub](https://github.com/exercism/dart/blob/master/exercises/hello-world/README.md)).
89
+ 1. Solve the exercise. Find and work through the `README.md` guide ([view on GitHub](https://github.com/exercism/dart/blob/master/exercises/hello-world/README.md)).
90
90
 
91
91
  Good luck! Have fun!
92
92
 
@@ -98,35 +98,35 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
98
98
 
99
99
  1. In the terminal window, get the first exercise:
100
100
 
101
- ```batchfile
102
- $ exercism fetch dart
101
+ ```shell
102
+ $ exercism fetch dart
103
103
 
104
- New: 1 problem
105
- Dart (Etl) /home/johndoe/exercism/dart/hello-world
104
+ New: 1 problem
105
+ Dart (Etl) /home/janedoe/exercism/dart/hello-world
106
106
 
107
- unchanged: 0, updated: 0, new: 1
108
- ```
107
+ unchanged: 0, updated: 0, new: 1
108
+ ```
109
109
 
110
- 2. Change directory into the exercise:
110
+ 1. Change directory into the exercise:
111
111
 
112
- ```batchfile
113
- $ cd /home/johndoe/exercism/dart/hello-world
114
- ```
112
+ ```shell
113
+ $ cd /home/janedoe/exercism/dart/hello-world
114
+ ```
115
115
 
116
- 3. Download the dependent packages:
116
+ 1. Download the dependent packages:
117
117
 
118
- ```batchfile
119
- $ pub get
120
- ```
118
+ ```shell
119
+ $ pub get
120
+ ```
121
121
 
122
- 4. Run the tests:
122
+ 1. Run the tests:
123
123
 
124
- ```batchfile
125
- $ pub run test
126
- ```
124
+ ```shell
125
+ $ pub run test
126
+ ```
127
127
  *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
128
128
 
129
- 6. Solve the exercise. Find and work through the `README.md` guide ([view on GitHub](https://github.com/exercism/dart/blob/master/exercises/hello-world/README.md)).
129
+ 1. Solve the exercise. Find and work through the `README.md` guide ([view on GitHub](https://github.com/exercism/dart/blob/master/exercises/hello-world/README.md)).
130
130
 
131
131
  Good luck! Have fun!
132
132
 
@@ -3,6 +3,7 @@ using System.Text.RegularExpressions;
3
3
  using System.Threading.Tasks;
4
4
 
5
5
  var target = Argument("target", "Default");
6
+ var exercise = Argument<string>("exercise", null);
6
7
 
7
8
  var sourceDir = "./exercises";
8
9
  var buildDir = "./build";
@@ -14,13 +15,13 @@ var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = System.Envi
14
15
  Task("Clean")
15
16
  .Does(() => {
16
17
  CleanDirectory(buildDir);
17
- });
18
+ });
18
19
 
19
20
  // Copy everything to build so we make no changes in the actual files.
20
21
  Task("CopyExercises")
21
22
  .IsDependentOn("Clean")
22
23
  .Does(() => {
23
- CopyDirectory(sourceDir, buildDir);
24
+ CopyDirectory($"{sourceDir}/{exercise}", $"{buildDir}/{exercise}");
24
25
  });
25
26
 
26
27
  Task("EnableAllTests")
@@ -53,11 +54,11 @@ Task("TestRefactoringProjects")
53
54
  Task("ReplaceStubWithExample")
54
55
  .IsDependentOn("TestRefactoringProjects")
55
56
  .Does(() => {
56
- var solution = ParseSolution(solutionPath);
57
+ var projects = GetFiles(buildDir + "/*/*.fsproj");
57
58
 
58
- foreach (var project in solution.Projects) {
59
- var projectDir = project.Path.GetDirectory();
60
- var projectName = project.Path.GetFilenameWithoutExtension();
59
+ foreach (var project in projects) {
60
+ var projectDir = project.GetDirectory();
61
+ var projectName = project.GetFilenameWithoutExtension();
61
62
  var stub = projectDir.GetFilePath(projectName).AppendExtension("fs");
62
63
  var example = projectDir.GetFilePath("Example.fs");
63
64
 
@@ -81,8 +82,8 @@ Task("AddPackagesUsedInExampleImplementations")
81
82
  Task("TestUsingExampleImplementation")
82
83
  .IsDependentOn("AddPackagesUsedInExampleImplementations")
83
84
  .Does(() => {
84
- var solution = ParseSolution(solutionPath);
85
- Parallel.ForEach(solution.Projects, parallelOptions, (project) => DotNetCoreTest(project.Path.FullPath));
85
+ var projects = GetFiles(buildDir + "/*/*.fsproj");
86
+ Parallel.ForEach(projects, parallelOptions, (project) => DotNetCoreTest(project.FullPath));
86
87
  });
87
88
 
88
89
  Task("Default")
@@ -6,7 +6,7 @@ open Acronym
6
6
 
7
7
  [<Fact>]
8
8
  let ``Empty string abbreviated to empty string`` () =
9
- acronym "" |> should equal ""
9
+ acronym "" |> should be EmptyString
10
10
 
11
11
  [<Fact(Skip = "Remove to run test")>]
12
12
  let ``Basic`` () =
@@ -24,7 +24,7 @@ let run text = eval text empty |> map formatStack
24
24
 
25
25
  [<Fact>]
26
26
  let ``No input, no stack`` () =
27
- formatStack empty |> should equal ""
27
+ formatStack empty |> should be EmptyString
28
28
 
29
29
  [<Fact(Skip = "Remove to run test")>]
30
30
  let ``Numbers just get pushed onto the stack`` () =
@@ -24,23 +24,24 @@ Open an administrative command prompt. (If you need assistance opening an admin
24
24
 
25
25
  1. If you have not installed Chocolatey, do so now:
26
26
 
27
- ```batchfile
28
- C:\Windows\system32> @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
29
- ```
27
+ ```batchfile
28
+ C:\Windows\system32> @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
29
+ ```
30
+
30
31
  2. Install the JDK:
31
32
 
32
- ```batchfile
33
- C:\Windows\system32> choco install jdk8
34
- ...
35
- C:\Windows\system32> refreshenv
36
- ...
37
- ```
33
+ ```batchfile
34
+ C:\Windows\system32> choco install jdk8
35
+ ...
36
+ C:\Windows\system32> refreshenv
37
+ ...
38
+ ```
38
39
  3. Install Gradle:
39
40
 
40
- ```batchfile
41
- C:\Windows\system32>choco install gradle
42
- ...
43
- ```
41
+ ```batchfile
42
+ C:\Windows\system32>choco install gradle
43
+ ...
44
+ ```
44
45
 
45
46
  We recommend closing the administrative command prompt and opening a new command prompt -- you do not require administrator privileges to practice Exercism exercises.
46
47
 
@@ -58,24 +59,27 @@ Below are instructions for install using the most common method - using Homebrew
58
59
 
59
60
  1. If you haven't installed [Homebrew](http://brew.sh), yet, do so now:
60
61
 
61
- ```sh
62
- $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
63
- ```
62
+ ```sh
63
+ $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
64
+ ```
65
+
64
66
  2. Tap the [Homebrew Cask](https://caskroom.github.io/) — this allows us to install pre-built binaries like the JDK.
65
67
 
66
- ```
67
- $ brew tap caskroom/cask
68
- ```
68
+ ```
69
+ $ brew tap caskroom/cask
70
+ ```
71
+
69
72
  3. Install the JDK:
70
73
 
71
- ```
72
- $ brew cask install java
73
- ```
74
+ ```
75
+ $ brew cask install java
76
+ ```
77
+
74
78
  4. Install Gradle:
75
79
 
76
- ```
77
- $ brew install gradle
78
- ```
80
+ ```
81
+ $ brew install gradle
82
+ ```
79
83
 
80
84
  You now are ready to get started with the Java track of Exercism!
81
85
 
@@ -98,21 +102,22 @@ If you are using Debian or its derivatives (like Ubuntu or Linux Mint), use APT:
98
102
 
99
103
  1. Install the JDK:
100
104
 
101
- ```sh
102
- $ sudo apt-get update
103
- $ sudo apt-get install python-software-properties
104
- $ sudo add-apt-repository ppa:webupd8team/java
105
- $ sudo apt-get update
106
- $ sudo apt-get install oracle-java8-installer
107
- $ sudo apt install oracle-java8-set-default
108
- ```
105
+ ```sh
106
+ $ sudo apt-get update
107
+ $ sudo apt-get install python-software-properties
108
+ $ sudo add-apt-repository ppa:webupd8team/java
109
+ $ sudo apt-get update
110
+ $ sudo apt-get install oracle-java8-installer
111
+ $ sudo apt install oracle-java8-set-default
112
+ ```
113
+
109
114
  2. Install Gradle:
110
115
 
111
- ```sh
112
- $ sudo add-apt-repository ppa:cwchien/gradle
113
- $ sudo apt-get update
114
- $ sudo apt-get install gradle
115
- ```
116
+ ```sh
117
+ $ sudo add-apt-repository ppa:cwchien/gradle
118
+ $ sudo apt-get update
119
+ $ sudo apt-get install gradle
120
+ ```
116
121
 
117
122
  You now are ready to get started with the Java track of Exercism!
118
123
 
@@ -128,14 +133,15 @@ If you are using Fedora or its derivatives, use DNF:
128
133
 
129
134
  1. Install the JDK:
130
135
 
131
- ```sh
132
- $ sudo dnf install java-1.8.0-openjdk-devel
133
- ```
136
+ ```sh
137
+ $ sudo dnf install java-1.8.0-openjdk-devel
138
+ ```
139
+
134
140
  2. Install Gradle:
135
141
 
136
- ```sh
137
- $ sudo dnf install gradle
138
- ```
142
+ ```sh
143
+ $ sudo dnf install gradle
144
+ ```
139
145
 
140
146
 
141
147
  You now are ready to get started with the Java track of Exercism!
@@ -183,20 +189,21 @@ To get started, see "[Running the Tests](http://exercism.io/languages/java/tests
183
189
  1. Download "**Binary only distribution**" from the [Gradle download page](https://gradle.org/gradle-download/).
184
190
  2. Unpack Gradle:
185
191
 
186
- ```sh
187
- $ mkdir ~/tools
188
- $ cd ~/tools
189
- $ unzip ~/Downloads/gradle-*-bin.zip
190
- $ cd gradle*
191
- ```
192
+ ```sh
193
+ $ mkdir ~/tools
194
+ $ cd ~/tools
195
+ $ unzip ~/Downloads/gradle-*-bin.zip
196
+ $ cd gradle*
197
+ ```
198
+
192
199
  3. Configure Gradle and add it to the path:
193
200
 
194
- ```sh
195
- $ cat << DONE >> ~/.bashrc
196
- export GRADLE_HOME=`pwd`
197
- export PATH=\$PATH:\$GRADLE_HOME/bin
198
- DONE
199
- ```
201
+ ```sh
202
+ $ cat << DONE >> ~/.bashrc
203
+ export GRADLE_HOME=`pwd`
204
+ export PATH=\$PATH:\$GRADLE_HOME/bin
205
+ DONE
206
+ ```
200
207
 
201
208
 
202
209
  You now are ready to get started with the Java track of Exercism!
@@ -216,20 +223,21 @@ To get started, see "[Running the Tests](http://exercism.io/languages/java/tests
216
223
  1. Download "**Binary only distribution**" from the [Gradle download page](https://gradle.org/gradle-download/).
217
224
  2. Unpack Gradle:
218
225
 
219
- ```sh
220
- $ mkdir ~/tools
221
- $ cd ~/tools
222
- $ unzip ~/Downloads/gradle-*-bin.zip
223
- $ cd gradle*
224
- ```
226
+ ```sh
227
+ $ mkdir ~/tools
228
+ $ cd ~/tools
229
+ $ unzip ~/Downloads/gradle-*-bin.zip
230
+ $ cd gradle*
231
+ ```
232
+
225
233
  3. Configure Gradle and add it to the path:
226
234
 
227
- ```sh
228
- $ cat << DONE >> ~/.bashrc
229
- export GRADLE_HOME=`pwd`
230
- export PATH=\$PATH:\$GRADLE_HOME/bin
231
- DONE
232
- ```
235
+ ```sh
236
+ $ cat << DONE >> ~/.bashrc
237
+ export GRADLE_HOME=`pwd`
238
+ export PATH=\$PATH:\$GRADLE_HOME/bin
239
+ DONE
240
+ ```
233
241
 
234
242
  You now are ready to get started with the Java track of Exercism!
235
243
 
@@ -13,30 +13,31 @@ Choose your operating system:
13
13
  1. Open a Command Prompt.
14
14
  2. Get the first exercise:
15
15
 
16
- ```batchfile
17
- C:\Users\JohnDoe>exercism fetch java
18
- 
19
- Not Submitted: 1 problem
20
- java (Hello World) C:\Users\JohnDoe\exercism\java\hello-world
21
-
22
- New: 1 problem
23
- java (Hello World) C:\Users\JohnDoe\exercism\java\hello-world
24
-
25
- unchanged: 0, updated: 0, new: 1
26
-
16
+ ```batchfile
17
+ C:\Users\JohnDoe>exercism fetch java
18
+
19
+ Not Submitted: 1 problem
20
+ java (Hello World) C:\Users\JohnDoe\exercism\java\hello-world
21
+
22
+ New: 1 problem
23
+ java (Hello World) C:\Users\JohnDoe\exercism\java\hello-world
24
+
25
+ unchanged: 0, updated: 0, new: 1
27
26
  ```
27
+
28
28
  3. Change directory into the exercism:
29
29
 
30
- ```batchfile
31
- C:\Users\JohnDoe>cd C:\Users\JohnDoe\exercism\java\hello-world
32
- ```
30
+ ```batchfile
31
+ C:\Users\JohnDoe>cd C:\Users\JohnDoe\exercism\java\hello-world
32
+ ```
33
33
 
34
34
  4. Run the tests:
35
35
 
36
- ```batchfile
37
- C:\Users\JohnDoe>gradle test
38
- ```
36
+ ```batchfile
37
+ C:\Users\JohnDoe>gradle test
38
+ ```
39
39
  *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
40
+
40
41
  5. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/java/blob/master/exercises/hello-world/TUTORIAL.md)).
41
42
 
42
43
 
@@ -50,26 +51,28 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
50
51
 
51
52
  1. In the terminal window, get the first exercise:
52
53
 
53
- ```
54
- $ exercism fetch java
54
+ ```
55
+ $ exercism fetch java
55
56
 
56
- New: 1 problem
57
- Java (Etl) /Users/johndoe/exercism/java/hello-world
57
+ New: 1 problem
58
+ Java (Etl) /Users/johndoe/exercism/java/hello-world
58
59
 
59
- unchanged: 0, updated: 0, new: 1
60
+ unchanged: 0, updated: 0, new: 1
61
+ ```
60
62
 
61
- ```
62
63
  2. Change directory into the exercise:
63
64
 
64
- ```
65
- $ cd /Users/johndoe/exercism/java/hello-world
66
- ```
65
+ ```
66
+ $ cd /Users/johndoe/exercism/java/hello-world
67
+ ```
68
+
67
69
  3. Run the tests:
68
70
 
69
- ```
70
- $ gradle test
71
- ```
71
+ ```
72
+ $ gradle test
73
+ ```
72
74
  *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
75
+
73
76
  4. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/java/blob/master/exercises/hello-world/TUTORIAL.md)).
74
77
 
75
78
  Good luck! Have fun!
@@ -82,26 +85,29 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
82
85
 
83
86
  1. In the terminal window, get the first exercise:
84
87
 
85
- ```
86
- $ exercism fetch java
88
+ ```
89
+ $ exercism fetch java
87
90
 
88
- New: 1 problem
89
- Java (Etl) /home/johndoe/exercism/java/hello-world
91
+ New: 1 problem
92
+ Java (Etl) /home/johndoe/exercism/java/hello-world
90
93
 
91
- unchanged: 0, updated: 0, new: 1
94
+ unchanged: 0, updated: 0, new: 1
95
+
96
+ ```
92
97
 
93
- ```
94
98
  2. Change directory into the exercise:
95
99
 
96
- ```
97
- $ cd /home/johndoe/exercism/java/hello-world
98
- ```
100
+ ```
101
+ $ cd /home/johndoe/exercism/java/hello-world
102
+ ```
103
+
99
104
  3. Run the tests:
100
105
 
101
- ```
102
- $ gradle test
103
- ```
106
+ ```
107
+ $ gradle test
108
+ ```
104
109
  *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
110
+
105
111
  4. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/java/blob/master/exercises/hello-world/TUTORIAL.md)).
106
112
 
107
113
  Good luck! Have fun!
@@ -20,14 +20,14 @@ module.exports = function (userDefinedKey) {
20
20
 
21
21
  function addEncodedCharacter(character, index, array) {
22
22
  /*jshint validthis:true */
23
- var i = ALPHABET.indexOf(character) + ALPHABET.indexOf(key[index]);
23
+ var i = ALPHABET.indexOf(character) + ALPHABET.indexOf(key[index%key.length]);
24
24
  if (i >= ALPHABET.length) { i -= ALPHABET.length; }
25
25
  this.push(ALPHABET[i]);
26
26
  }
27
27
 
28
28
  function addDecodedCharacter(character, index, array) {
29
29
  /*jshint validthis:true */
30
- var i = ALPHABET.indexOf(character) - ALPHABET.indexOf(key[index]);
30
+ var i = ALPHABET.indexOf(character) - ALPHABET.indexOf(key[index%key.length]);
31
31
  if (i < 0) { i += ALPHABET.length; }
32
32
  this.push(ALPHABET[i]);
33
33
  }
@@ -50,4 +50,4 @@ module.exports = function (userDefinedKey) {
50
50
  if (userDefinedKey === '' || key.match(/[\dA-Z]/)) {
51
51
  throw new Error('Bad key');
52
52
  }
53
- };
53
+ };
@@ -72,4 +72,9 @@ describe('Substitution cipher', function () {
72
72
  xit('can wrap', function () {
73
73
  expect(cipher.encode('zzzzzzzzzz')).toEqual('zabcdefghi');
74
74
  });
75
+
76
+ xit('can handle messages longer than the key', function() {
77
+ expect(new Cipher('abc').encode('iamapandabear'))
78
+ .toEqual('iboaqcnecbfcr');
79
+ });
75
80
  });
@@ -1,5 +1,5 @@
1
1
  object SumOfMultiples {
2
- def sumOfMultiples(factors: Set[Int], limit: Int): Int = {
2
+ def sum(factors: Set[Int], limit: Int): Int = {
3
3
  def isDivisibleBy(x: Int)(y: Int): Boolean = x % y == 0
4
4
  def isMultiple(x: Int): Boolean = factors exists isDivisibleBy(x)
5
5
 
@@ -1,4 +1,4 @@
1
1
  object SumOfMultiples {
2
- def sumOfMultiples(factors: Set[Int], limit: Int): Int = ???
2
+ def sum(factors: Set[Int], limit: Int): Int = ???
3
3
  }
4
4
 
@@ -1,62 +1,64 @@
1
- import org.scalatest.{FunSuite, Matchers}
1
+ import org.scalatest.{Matchers, FunSuite}
2
2
 
3
+ /** @version 1.0.0 */
3
4
  class SumOfMultiplesTest extends FunSuite with Matchers {
4
- test("[3, 5] 1") {
5
- SumOfMultiples.sumOfMultiples(Set(3, 5), 1) should be (0)
5
+
6
+ test("multiples of 3 or 5 up to 1") {
7
+ SumOfMultiples.sum(Set(3, 5), 1) should be (0)
6
8
  }
7
9
 
8
- test("[3, 5] 4") {
10
+ test("multiples of 3 or 5 up to 4") {
9
11
  pending
10
- SumOfMultiples.sumOfMultiples(Set(3, 5), 4) should be (3)
12
+ SumOfMultiples.sum(Set(3, 5), 4) should be (3)
11
13
  }
12
14
 
13
- test("[3, 5] 10") {
15
+ test("multiples of 3 or 5 up to 10") {
14
16
  pending
15
- SumOfMultiples.sumOfMultiples(Set(3, 5), 10) should be (23)
17
+ SumOfMultiples.sum(Set(3, 5), 10) should be (23)
16
18
  }
17
19
 
18
- test("[3, 5] 100") {
20
+ test("multiples of 3 or 5 up to 100") {
19
21
  pending
20
- SumOfMultiples.sumOfMultiples(Set(3, 5), 100) should be (2318)
22
+ SumOfMultiples.sum(Set(3, 5), 100) should be (2318)
21
23
  }
22
24
 
23
- test("[3, 5] 1000") {
25
+ test("multiples of 3 or 5 up to 1000") {
24
26
  pending
25
- SumOfMultiples.sumOfMultiples(Set(3, 5), 1000) should be (233168)
27
+ SumOfMultiples.sum(Set(3, 5), 1000) should be (233168)
26
28
  }
27
29
 
28
- test("[7, 13, 17] 20") {
30
+ test("multiples of 7, 13 or 17 up to 20") {
29
31
  pending
30
- SumOfMultiples.sumOfMultiples(Set(7, 13, 17), 20) should be (51)
32
+ SumOfMultiples.sum(Set(7, 13, 17), 20) should be (51)
31
33
  }
32
34
 
33
- test("[4, 6] 15") {
35
+ test("multiples of 4 or 6 up to 15") {
34
36
  pending
35
- SumOfMultiples.sumOfMultiples(Set(4, 6), 15) should be (30)
37
+ SumOfMultiples.sum(Set(4, 6), 15) should be (30)
36
38
  }
37
39
 
38
- test("[5, 6, 8] 150") {
40
+ test("multiples of 5, 6 or 8 up to 150") {
39
41
  pending
40
- SumOfMultiples.sumOfMultiples(Set(5, 6, 8), 150) should be (4419)
42
+ SumOfMultiples.sum(Set(5, 6, 8), 150) should be (4419)
41
43
  }
42
44
 
43
- test("[5, 25] 51") {
45
+ test("multiples of 5 or 25 up to 51") {
44
46
  pending
45
- SumOfMultiples.sumOfMultiples(Set(5, 25), 51) should be (275)
47
+ SumOfMultiples.sum(Set(5, 25), 51) should be (275)
46
48
  }
47
49
 
48
- test("[43, 47] 10000") {
50
+ test("multiples of 43 or 47 up to 10000") {
49
51
  pending
50
- SumOfMultiples.sumOfMultiples(Set(43, 47), 10000) should be (2203160)
52
+ SumOfMultiples.sum(Set(43, 47), 10000) should be (2203160)
51
53
  }
52
54
 
53
- test("[1] 100") {
55
+ test("multiples of 1 up to 100") {
54
56
  pending
55
- SumOfMultiples.sumOfMultiples(Set(1), 100) should be (4950)
57
+ SumOfMultiples.sum(Set(1), 100) should be (4950)
56
58
  }
57
59
 
58
- test("[] 10000") {
60
+ test("multiples of an empty list up to 10000") {
59
61
  pending
60
- SumOfMultiples.sumOfMultiples(Set(), 10000) should be (0)
62
+ SumOfMultiples.sum(Set(), 10000) should be (0)
61
63
  }
62
- }
64
+ }
@@ -3,6 +3,38 @@ import TestSuiteBuilder._
3
3
  import java.io.File
4
4
 
5
5
  object SumOfMultiplesTestGenerator {
6
+ def toArgString(any: Any): String = {
7
+ any match {
8
+ case list: List[_] =>
9
+ val vals = list.map(s => TestSuiteBuilder.toString(s)).mkString(", ")
10
+ s"Set($vals)"
11
+ case lstr: Long =>
12
+ lstr.toString + "l"
13
+ case _ => any.toString
14
+ }
15
+ }
16
+
17
+ def sutArgs(parseResult: CanonicalDataParser.ParseResult, argNames: String*): String =
18
+ argNames map (name => toArgString(parseResult(name))) mkString ", "
19
+
20
+ def toString(expected: CanonicalDataParser.Expected): String = {
21
+ expected match {
22
+ case Left(_) => throw new IllegalStateException()
23
+ case Right(n) => s"$n"
24
+ }
25
+ }
26
+
27
+ def fromLabeledTest(argNames: String*): ToTestCaseData =
28
+ withLabeledTest { sut =>
29
+ labeledTest =>
30
+ val args = sutArgs(labeledTest.result, argNames: _*)
31
+ val property = labeledTest.property
32
+ val sutCall =
33
+ s"$sut.$property($args)"
34
+ val expected = toString(labeledTest.expected)
35
+ TestCaseData(labeledTest.description, sutCall, expected)
36
+ }
37
+
6
38
  def main(args: Array[String]): Unit = {
7
39
  val file = new File("src/main/resources/sum-of-multiples.json")
8
40
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1.23
4
+ version: 2.2.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-02 00:00:00.000000000 Z
11
+ date: 2017-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -1777,6 +1777,7 @@ files:
1777
1777
  - tracks/crystal/docs/INSTALLATION.md
1778
1778
  - tracks/crystal/docs/LEARNING.md
1779
1779
  - tracks/crystal/docs/RESOURCES.md
1780
+ - tracks/crystal/docs/SNIPPET.txt
1780
1781
  - tracks/crystal/docs/TESTS.md
1781
1782
  - tracks/crystal/exercises/acronym/README.md
1782
1783
  - tracks/crystal/exercises/acronym/spec/acronym_spec.cr