trackler 2.1.0.25 → 2.1.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +10 -0
  3. data/bin/bootstrap +6 -0
  4. data/common/CONTRIBUTING.md +2 -2
  5. data/lib/trackler/version.rb +1 -1
  6. data/tracks/coffeescript/LICENSE +2 -2
  7. data/tracks/coffeescript/README.md +0 -5
  8. data/tracks/coldfusion/LICENSE +2 -2
  9. data/tracks/coldfusion/README.md +0 -5
  10. data/tracks/crystal/LICENSE +2 -2
  11. data/tracks/crystal/README.md +0 -5
  12. data/tracks/dlang/.travis.yml +4 -2
  13. data/tracks/dlang/LICENSE +2 -2
  14. data/tracks/dlang/README.md +3 -6
  15. data/tracks/dlang/bin/test-all-exercises +20 -0
  16. data/tracks/dlang/bin/test-exercise +16 -0
  17. data/tracks/dlang/config.json +0 -18
  18. data/tracks/dlang/exercises/difference-of-squares/difference_of_squares.d +6 -3
  19. data/tracks/dlang/exercises/difference-of-squares/difference_of_squares_example.d +17 -0
  20. data/tracks/dlang/exercises/gigasecond/gigasecond.d +7 -3
  21. data/tracks/dlang/exercises/gigasecond/gigasecond_example.d +15 -0
  22. data/tracks/dlang/exercises/hello-world/hello_world.d +4 -3
  23. data/tracks/dlang/exercises/hello-world/hello_world_example.d +9 -0
  24. data/tracks/dlang/exercises/nucleotide-count/nucleotide_count.d +1 -1
  25. data/tracks/dlang/exercises/raindrops/raindrops.d +6 -3
  26. data/tracks/dlang/exercises/raindrops/raindrops_example.d +20 -0
  27. data/tracks/dlang/exercises/rna-transcription/rna_transcription.d +7 -3
  28. data/tracks/dlang/exercises/rna-transcription/rna_transcription_example.d +15 -0
  29. data/tracks/ecmascript/exercises/accumulate/package.json +25 -39
  30. data/tracks/ecmascript/exercises/acronym/package.json +25 -39
  31. data/tracks/ecmascript/exercises/all-your-base/package.json +25 -39
  32. data/tracks/ecmascript/exercises/allergies/package.json +25 -39
  33. data/tracks/ecmascript/exercises/anagram/package.json +25 -39
  34. data/tracks/ecmascript/exercises/atbash-cipher/package.json +25 -39
  35. data/tracks/ecmascript/exercises/beer-song/package.json +25 -39
  36. data/tracks/ecmascript/exercises/binary/package.json +25 -39
  37. data/tracks/ecmascript/exercises/binary-search/example.js +3 -1
  38. data/tracks/ecmascript/exercises/binary-search/package.json +25 -39
  39. data/tracks/ecmascript/exercises/binary-search-tree/package.json +25 -39
  40. data/tracks/ecmascript/exercises/bob/bob.js +1 -0
  41. data/tracks/ecmascript/exercises/bob/package.json +25 -39
  42. data/tracks/ecmascript/exercises/bracket-push/package.json +25 -39
  43. data/tracks/ecmascript/exercises/circular-buffer/package.json +25 -39
  44. data/tracks/ecmascript/exercises/clock/package.json +25 -39
  45. data/tracks/ecmascript/exercises/connect/example.js +4 -1
  46. data/tracks/ecmascript/exercises/connect/package.json +25 -39
  47. data/tracks/ecmascript/exercises/crypto-square/package.json +25 -39
  48. data/tracks/ecmascript/exercises/custom-set/package.json +25 -39
  49. data/tracks/ecmascript/exercises/diamond/example.js +3 -4
  50. data/tracks/ecmascript/exercises/diamond/package.json +25 -39
  51. data/tracks/ecmascript/exercises/difference-of-squares/package.json +25 -39
  52. data/tracks/ecmascript/exercises/etl/package.json +25 -39
  53. data/tracks/ecmascript/exercises/food-chain/package.json +25 -39
  54. data/tracks/ecmascript/exercises/gigasecond/package.json +25 -39
  55. data/tracks/ecmascript/exercises/grade-school/package.json +25 -39
  56. data/tracks/ecmascript/exercises/grains/lib/big-integer.js +1153 -1152
  57. data/tracks/ecmascript/exercises/grains/package.json +25 -39
  58. data/tracks/ecmascript/exercises/hamming/package.json +25 -39
  59. data/tracks/ecmascript/exercises/hello-world/package.json +25 -39
  60. data/tracks/ecmascript/exercises/hexadecimal/package.json +25 -39
  61. data/tracks/ecmascript/exercises/isogram/package.json +25 -39
  62. data/tracks/ecmascript/exercises/kindergarten-garden/package.json +25 -39
  63. data/tracks/ecmascript/exercises/largest-series-product/example.js +8 -2
  64. data/tracks/ecmascript/exercises/largest-series-product/package.json +25 -39
  65. data/tracks/ecmascript/exercises/leap/package.json +25 -39
  66. data/tracks/ecmascript/exercises/linked-list/package.json +25 -39
  67. data/tracks/ecmascript/exercises/luhn/package.json +25 -39
  68. data/tracks/ecmascript/exercises/matrix/package.json +25 -39
  69. data/tracks/ecmascript/exercises/meetup/example.js +3 -5
  70. data/tracks/ecmascript/exercises/meetup/meetup.spec.js +2 -5
  71. data/tracks/ecmascript/exercises/meetup/package.json +25 -39
  72. data/tracks/ecmascript/exercises/nth-prime/package.json +25 -39
  73. data/tracks/ecmascript/exercises/ocr-numbers/package.json +25 -39
  74. data/tracks/ecmascript/exercises/octal/package.json +25 -39
  75. data/tracks/ecmascript/exercises/package.json +24 -40
  76. data/tracks/ecmascript/exercises/palindrome-products/package.json +25 -39
  77. data/tracks/ecmascript/exercises/pangram/package.json +25 -39
  78. data/tracks/ecmascript/exercises/pascals-triangle/package.json +25 -39
  79. data/tracks/ecmascript/exercises/perfect-numbers/example.js +5 -7
  80. data/tracks/ecmascript/exercises/perfect-numbers/package.json +25 -39
  81. data/tracks/ecmascript/exercises/phone-number/package.json +25 -39
  82. data/tracks/ecmascript/exercises/pig-latin/package.json +25 -39
  83. data/tracks/ecmascript/exercises/prime-factors/package.json +25 -39
  84. data/tracks/ecmascript/exercises/pythagorean-triplet/package.json +25 -39
  85. data/tracks/ecmascript/exercises/queen-attack/package.json +25 -39
  86. data/tracks/ecmascript/exercises/queen-attack/queen-attack.spec.js +1 -2
  87. data/tracks/ecmascript/exercises/raindrops/package.json +25 -39
  88. data/tracks/ecmascript/exercises/rna-transcription/example.js +1 -2
  89. data/tracks/ecmascript/exercises/rna-transcription/package.json +25 -39
  90. data/tracks/ecmascript/exercises/robot-name/package.json +25 -39
  91. data/tracks/ecmascript/exercises/robot-simulator/package.json +25 -39
  92. data/tracks/ecmascript/exercises/roman-numerals/package.json +25 -39
  93. data/tracks/ecmascript/exercises/saddle-points/example.js +1 -1
  94. data/tracks/ecmascript/exercises/saddle-points/package.json +25 -39
  95. data/tracks/ecmascript/exercises/say/package.json +25 -39
  96. data/tracks/ecmascript/exercises/scrabble-score/package.json +25 -39
  97. data/tracks/ecmascript/exercises/secret-handshake/package.json +25 -39
  98. data/tracks/ecmascript/exercises/series/package.json +25 -39
  99. data/tracks/ecmascript/exercises/sieve/example.js +1 -1
  100. data/tracks/ecmascript/exercises/sieve/package.json +25 -39
  101. data/tracks/ecmascript/exercises/simple-cipher/package.json +25 -39
  102. data/tracks/ecmascript/exercises/space-age/package.json +25 -39
  103. data/tracks/ecmascript/exercises/strain/package.json +25 -39
  104. data/tracks/ecmascript/exercises/sum-of-multiples/package.json +25 -39
  105. data/tracks/ecmascript/exercises/triangle/package.json +25 -39
  106. data/tracks/ecmascript/exercises/trinary/package.json +25 -39
  107. data/tracks/ecmascript/exercises/two-bucket/package.json +25 -39
  108. data/tracks/ecmascript/exercises/word-count/package.json +25 -39
  109. data/tracks/ecmascript/exercises/wordy/package.json +25 -39
  110. data/tracks/ecmascript/package.json +25 -39
  111. data/tracks/factor/config.json +0 -6
  112. data/tracks/go/exercises/variable-length-quantity/.meta/gen.go +0 -8
  113. data/tracks/go/exercises/variable-length-quantity/cases_test.go +0 -9
  114. data/tracks/go/exercises/variable-length-quantity/example.go +5 -5
  115. data/tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go +2 -4
  116. data/tracks/groovy/LICENSE +2 -2
  117. data/tracks/groovy/README.md +0 -5
  118. data/tracks/haxe/LICENSE +2 -2
  119. data/tracks/haxe/README.md +0 -5
  120. data/tracks/nasm/LICENSE +21 -0
  121. data/tracks/nasm/README.md +1 -6
  122. data/tracks/nim/LICENSE +21 -0
  123. data/tracks/nim/README.md +0 -5
  124. data/tracks/plsql/LICENSE +2 -2
  125. data/tracks/plsql/README.md +0 -5
  126. data/tracks/plsql/config.json +52 -12
  127. data/tracks/pony/LICENSE +2 -2
  128. data/tracks/pony/README.md +0 -5
  129. data/tracks/powershell/LICENSE +21 -0
  130. data/tracks/powershell/README.md +0 -5
  131. data/tracks/prolog/LICENSE +2 -2
  132. data/tracks/prolog/README.md +1 -6
  133. data/tracks/purescript/LICENSE +2 -2
  134. data/tracks/purescript/README.md +0 -5
  135. data/tracks/ruby/exercises/meetup/.meta/solutions/meetup.rb +1 -0
  136. data/tracks/ruby/exercises/meetup/meetup_test.rb +0 -1
  137. data/tracks/sml/LICENSE +21 -0
  138. data/tracks/sml/README.md +0 -5
  139. data/tracks/tcl/LICENSE +2 -2
  140. data/tracks/tcl/README.md +1 -6
  141. data/tracks/teco/LICENSE +2 -2
  142. data/tracks/teco/README.md +0 -5
  143. data/tracks/vbnet/LICENSE +21 -0
  144. data/tracks/vbnet/README.md +0 -5
  145. data/tracks/vimscript/config.json +5 -0
  146. data/tracks/vimscript/exercises/scrabble-score/example.vim +21 -0
  147. data/tracks/vimscript/exercises/scrabble-score/scrabble_score.vader +62 -0
  148. data/tracks/vimscript/exercises/scrabble-score/scrabble_score.vim +16 -0
  149. metadata +13 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e992178474e75584ead434f6949b980b992ed45
4
- data.tar.gz: d6b4cbd00de3ee42f96e025937e18154edfab66e
3
+ metadata.gz: 1ea219b914ea27b18a90012564e931c53e884090
4
+ data.tar.gz: df9c745c274ad3550a164005870ea87fd21f3280
5
5
  SHA512:
6
- metadata.gz: 67568e6b9ef2079e4f16e767c01c147d664b12a3629196b517c12f74a9124a5d82e2c214623153ab0b59d9b26b60d96218d46eea64dcaaef693f49c8c62c043b
7
- data.tar.gz: 2ac45474dfdfda50caa53c35dfccb94b9ec5947cd77570fb82ac9d159c95a9efc1bfe381178c6c2055a5869a91b85e1f05b7e0830d2a2eeafc241fccefa6b812
6
+ metadata.gz: a88822ba8bd2eeab47286b16a9fb78aa3b0e6fdc0c99052f864e4f2ae9bd2d1c55a29066273aa8b4d2b8aac598de04cac5a0dd871a18b13bba7cb2271562e4de
7
+ data.tar.gz: 2f52002a03364a07944ff01a903c4da38d9859362179e043acbb7701ab03beae1eb03a800b9bc034518b732029889e86c4603a1b85c1190d5eb5755d0489c9e9
data/CONTRIBUTING.md CHANGED
@@ -8,6 +8,16 @@ also included as a [git submodule][submodule] in `./common`.
8
8
 
9
9
  A git submodule is essentially a project in another project.
10
10
 
11
+ ## Development Environment
12
+
13
+ Clone the git repository, then run the bootstrap script:
14
+
15
+ ```
16
+ $ git clone https://github.com/exercism/trackler.git
17
+ $ cd trackler
18
+ $ bin/bootstrap
19
+ ```
20
+
11
21
  ## Terminology
12
22
 
13
23
  Check out the [glossary][] for an overview of the important terms for Exercism, many
data/bin/bootstrap ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ git submodule init
4
+ git submodule update
5
+ gem install bundler
6
+ bundle install
@@ -44,8 +44,8 @@ themselves. There are other guides about contributing to other parts of the Exer
44
44
  * [Track-Level Linting With Configlet](#track-level-linting-with-configlet)
45
45
  * [Git Basics](#git-basics)
46
46
  * [Getting the Code](#getting-the-code)
47
- * [Branches](#branches)
48
- * [Commit Messages](#commit-messages)
47
+ * [Branches](#branches)
48
+ * [Commit Messages](#commit-messages)
49
49
  * [Resetting `master`](#resetting-master)
50
50
  * [Squashing](#squashing)
51
51
  * [Resources](#resources)
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.1.0.25"
2
+ VERSION = "2.1.0.26"
3
3
  end
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
3
+ Copyright (c) 2017 Exercism, Inc
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -6,11 +6,6 @@ Exercism exercises in CoffeeScript
6
6
 
7
7
  Please see the [contributing guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data)
8
8
 
9
- ## License
10
-
11
- The MIT License (MIT)
12
-
13
- Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
14
9
 
15
10
  ### CoffeeScript icon
16
11
  We were unable to find a license for the CoffeeScript logo, however we believe that it is owned by Jeremy Ashkenas, who holds the copyright on the CoffeeScript language.
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
3
+ Copyright (c) 2017 Exercism, Inc
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -10,9 +10,4 @@ _Document how to contribute to the ColdFusion track._
10
10
 
11
11
  Please see the [contributing guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data)
12
12
 
13
- ## License
14
-
15
- The MIT License (MIT)
16
-
17
- Copyright (c) 2015 Katrina Owen, _@kytrinyx.com
18
13
 
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (c) 2015 Katrina Owen, _@kytrinyx.com
3
+ Copyright (c) 2017 Exercism, Inc
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -47,11 +47,6 @@ $ bin/generate hello-world
47
47
 
48
48
  Please see the [contributing guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data)
49
49
 
50
- ## License
51
-
52
- The MIT License (MIT)
53
-
54
- Copyright (c) 2016 Katrina Owen, _@kytrinyx.com
55
50
 
56
51
  ### Crystal logo
57
52
  The Crystal logo is assumed to be owned by Manas SA. It appears to be released under version 2.0 of the Apache license, along with the Crystal codebase. It may also fall within the public domain, since the version we are using is a geometric shape. We have cropped it for use on Exercism.
@@ -1,6 +1,8 @@
1
1
  ---
2
- language: bash
3
- script:
2
+ language: d
3
+ install:
4
4
  - bin/fetch-configlet
5
+ script:
5
6
  - bin/configlet .
7
+ - bin/test-all-exercises
6
8
  sudo: false
data/tracks/dlang/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
3
+ Copyright (c) 2017 Exercism, Inc
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -2,6 +2,8 @@
2
2
 
3
3
  Exercism exercises in the D Programming Language
4
4
 
5
+ [![Build Status](https://travis-ci.org/exercism/xdlang.svg?branch=master)](https://travis-ci.org/exercism/xdlang)
6
+
5
7
  ## Filenames
6
8
 
7
9
  Each exercise is identified by a slug.
@@ -30,11 +32,6 @@ exercises/circular-buffer/
30
32
 
31
33
  Please see the [contributing guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data)
32
34
 
33
- ## License
34
-
35
- The MIT License (MIT)
36
-
37
- Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
38
35
 
39
36
  ### D icon
40
- The D "Digital Mars" logo is owned by Digital Mars, Inc. Digital Mars, Inc. allows anyone to use, modify and redistribute the logo provided that the copyright holder is properly attributed. The original image is part of the D programming language "dlang.org" source repository, released under version 1.0 of the Boost Software License. We have modified the image, changing the colour scheme, to create the D icon for Exercism.
37
+ The D "Digital Mars" logo is owned by Digital Mars, Inc. Digital Mars, Inc. allows anyone to use, modify and redistribute the logo provided that the copyright holder is properly attributed. The original image is part of the D programming language "dlang.org" source repository, released under version 1.0 of the Boost Software License. We have modified the image, changing the colour scheme, to create the D icon for Exercism.
@@ -0,0 +1,20 @@
1
+ #!/bin/sh
2
+
3
+ test_one=$(dirname $0)/test-exercise
4
+ exercises=$(dirname $(dirname $0))/exercises
5
+ status=0
6
+ failed_exercises=""
7
+
8
+ for d in $exercises/*/; do
9
+ if ! $test_one $d; then
10
+ failed_exercises="$failed_exercises\n$(basename $d)"
11
+ status=1
12
+ fi
13
+ done
14
+
15
+ if [ $status -ne 0 ]; then
16
+ echo "The following exercises failed"
17
+ echo $failed_exercises
18
+ fi
19
+
20
+ exit $status
@@ -0,0 +1,16 @@
1
+ #!/bin/sh
2
+
3
+ if [ $# -eq 0 ]; then
4
+ echo "usage: $0 exercise-slug"
5
+ exit 1
6
+ fi
7
+
8
+ dir=$1
9
+ exercise=$(basename $dir)
10
+ underscored=$(echo "$exercise" | tr - _)
11
+ example="${underscored}_example"
12
+ backupext=testbak
13
+
14
+ cd $dir
15
+
16
+ dmd ${example}.d -de -w -unittest && ./$example
@@ -4,24 +4,6 @@
4
4
  "repository": "https://github.com/exercism/xdlang",
5
5
  "checklist_issue": 6,
6
6
  "active": true,
7
- "problems": [
8
- "hello-world",
9
- "gigasecond",
10
- "rna-transcription",
11
- "raindrops",
12
- "bob",
13
- "etl",
14
- "hamming",
15
- "nucleotide-count",
16
- "robot-name",
17
- "difference-of-squares",
18
- "roman-numerals",
19
- "series",
20
- "triangle",
21
- "crypto-square",
22
- "circular-buffer",
23
- "pangram"
24
- ],
25
7
  "exercises": [
26
8
  {
27
9
  "slug": "hello-world",
@@ -1,9 +1,10 @@
1
1
  module difference_of_squares;
2
2
 
3
- import std.stdio;
3
+ unittest {
4
+ const int allTestsEnabled = 0;
4
5
 
5
- void main() {
6
6
  assert(squares(5).squareOfSum == 225);
7
+ static if (allTestsEnabled) {
7
8
  assert(squares(10).squareOfSum == 3_025);
8
9
  assert(squares(100).squareOfSum == 25_502_500);
9
10
 
@@ -15,6 +16,8 @@ void main() {
15
16
  assert(squares(5).difference == 170);
16
17
  assert(squares(10).difference == 2_640);
17
18
  assert(squares(100).difference == 25_164_150);
19
+ }
18
20
 
19
- writeln("All tests passed");
20
21
  }
22
+
23
+ void main() {}
@@ -25,3 +25,20 @@ struct Squares {
25
25
  Squares squares(uint max) pure {
26
26
  return Squares(max);
27
27
  }
28
+
29
+ unittest {
30
+ assert(squares(5).squareOfSum == 225);
31
+ assert(squares(10).squareOfSum == 3_025);
32
+ assert(squares(100).squareOfSum == 25_502_500);
33
+
34
+ assert(squares(5).sumOfSquares == 55);
35
+ assert(squares(10).sumOfSquares == 385);
36
+ assert(squares(100).sumOfSquares == 338_350);
37
+
38
+ assert(squares(0).difference == 0);
39
+ assert(squares(5).difference == 170);
40
+ assert(squares(10).difference == 2_640);
41
+ assert(squares(100).difference == 25_164_150);
42
+ }
43
+
44
+ void main () {}
@@ -1,10 +1,12 @@
1
1
  module gigasecond;
2
2
 
3
- import std.stdio;
4
3
  import std.datetime;
5
4
 
6
- void main() {
5
+ unittest {
6
+ const int allTestsEnabled = 0;
7
+
7
8
  assert(gsAnniversary(DateTime(2011, 4, 25)) == DateTime(2043, 1, 1, 1, 46, 40));
9
+ static if (allTestsEnabled) {
8
10
  assert(gsAnniversary(DateTime(1977, 6, 13)) == DateTime(2009, 2, 19, 1, 46, 40));
9
11
  assert(gsAnniversary(DateTime(1959, 7, 19)) == DateTime(1991, 3, 27, 1, 46, 40));
10
12
  assert(gsAnniversary(DateTime(2015, 1, 24, 22, 0, 0)) == DateTime(2046, 10, 2, 23, 46, 40));
@@ -16,6 +18,8 @@ void main() {
16
18
  assert(d == DateTime(2011, 4, 25));
17
19
 
18
20
  //For fun add a test for your own gigasecond anniversary
21
+ }
19
22
 
20
- writeln("All tests pass");
21
23
  }
24
+
25
+ void main() {}
@@ -8,3 +8,18 @@ enum Gigasecond = seconds(10^^9);
8
8
  DateTime gsAnniversary(in DateTime start) pure {
9
9
  return start + Gigasecond;
10
10
  }
11
+
12
+ unittest {
13
+ assert(gsAnniversary(DateTime(2011, 4, 25)) == DateTime(2043, 1, 1, 1, 46, 40));
14
+ assert(gsAnniversary(DateTime(1977, 6, 13)) == DateTime(2009, 2, 19, 1, 46, 40));
15
+ assert(gsAnniversary(DateTime(1959, 7, 19)) == DateTime(1991, 3, 27, 1, 46, 40));
16
+ assert(gsAnniversary(DateTime(2015, 1, 24, 22, 0, 0)) == DateTime(2046, 10, 2, 23, 46, 40));
17
+ assert(gsAnniversary(DateTime(2015, 1, 24, 23, 59, 59)) == DateTime(2046, 10, 3, 1, 46, 39));
18
+
19
+ //check that it doesn't mutate the argument
20
+ auto d = DateTime(2011, 4, 25);
21
+ assert(gsAnniversary(d) == DateTime(2043, 1, 1, 1, 46, 40));
22
+ assert(d == DateTime(2011, 4, 25));
23
+ }
24
+
25
+ void main () {}
@@ -1,12 +1,13 @@
1
1
  module helloworld_test;
2
2
 
3
- import std.stdio;
3
+ unittest {
4
+ const int allTestsEnabled = 0;
4
5
 
5
- void main() {
6
6
  assert(hello() == "Hello, World!");
7
+ static if (allTestsEnabled) {
7
8
  assert(hello("Alice") == "Hello, Alice!");
8
9
  assert(hello("Bob") == "Hello, Bob!");
9
10
  assert(hello("") == "Hello, !");
11
+ }
10
12
 
11
- writeln("All tests passed.");
12
13
  }
@@ -5,3 +5,12 @@ import std.format;
5
5
  string hello(const char[] name = "World") {
6
6
  return format("Hello, %s!", name);
7
7
  }
8
+
9
+ unittest {
10
+ assert(hello() == "Hello, World!");
11
+ assert(hello("Alice") == "Hello, Alice!");
12
+ assert(hello("Bob") == "Hello, Bob!");
13
+ assert(hello("") == "Hello, !");
14
+ }
15
+
16
+ void main () {}
@@ -10,7 +10,7 @@ unittest
10
10
  {
11
11
 
12
12
  // test associative array equality
13
- bool aaEqual (const int[char] lhs, const int[char] rhs)
13
+ bool aaEqual (const ulong[char] lhs, const ulong[char] rhs)
14
14
  {
15
15
  auto lhs_pairs = lhs.byKeyValue.array;
16
16
  auto rhs_pairs = rhs.byKeyValue.array;
@@ -1,7 +1,8 @@
1
- import std.stdio;
1
+ unittest {
2
+ const int allTestsEnabled = 0;
2
3
 
3
- void main() {
4
4
  assert(convert(1) == "1");
5
+ static if (allTestsEnabled) {
5
6
  assert(convert(3) == "Pling");
6
7
  assert(convert(5) == "Plang");
7
8
  assert(convert(7) == "Plong");
@@ -16,6 +17,8 @@ void main() {
16
17
  assert(convert(49) == "Plong");
17
18
  assert(convert(52) == "52");
18
19
  assert(convert(105) == "PlingPlangPlong");
20
+ }
19
21
 
20
- writeln("All tests passed");
21
22
  }
23
+
24
+ void main() {}
@@ -33,3 +33,23 @@ private bool isPlang(int n) {
33
33
  private bool isPlong(int n) {
34
34
  return n % 7 == 0;
35
35
  }
36
+
37
+ unittest {
38
+ assert(convert(1) == "1");
39
+ assert(convert(3) == "Pling");
40
+ assert(convert(5) == "Plang");
41
+ assert(convert(7) == "Plong");
42
+ assert(convert(6) == "Pling");
43
+ assert(convert(9) == "Pling");
44
+ assert(convert(10) == "Plang");
45
+ assert(convert(14) == "Plong");
46
+ assert(convert(15) == "PlingPlang");
47
+ assert(convert(21) == "PlingPlong");
48
+ assert(convert(25) == "Plang");
49
+ assert(convert(35) == "PlangPlong");
50
+ assert(convert(49) == "Plong");
51
+ assert(convert(52) == "52");
52
+ assert(convert(105) == "PlingPlangPlong");
53
+ }
54
+
55
+ void main () {}
@@ -1,10 +1,12 @@
1
1
  module rna_transcription;
2
2
 
3
3
  import std.exception : assertThrown;
4
- import std.stdio;
5
4
 
6
- void main() {
5
+ unittest {
6
+ const int allTestsEnabled = 0;
7
+
7
8
  assert(dnaComplement("C") == "G");
9
+ static if (allTestsEnabled) {
8
10
  assert(dnaComplement("G") == "C");
9
11
  assert(dnaComplement("T") == "A");
10
12
  assert(dnaComplement("A") == "U");
@@ -14,6 +16,8 @@ void main() {
14
16
  assertThrown(dnaComplement("U"));
15
17
  assertThrown(dnaComplement("XXX"));
16
18
  assertThrown(dnaComplement("ACGTXXXCTTAA"));
19
+ }
17
20
 
18
- writeln("All tests passed");
19
21
  }
22
+
23
+ void main() {}
@@ -20,3 +20,18 @@ string dnaComplement(string dna) {
20
20
  enforce(dna.matchFirst(dnaRegex), "Invalid DNA string");
21
21
  return dna.translate(rnaTransTable);
22
22
  }
23
+
24
+ unittest {
25
+ assert(dnaComplement("C") == "G");
26
+ assert(dnaComplement("G") == "C");
27
+ assert(dnaComplement("T") == "A");
28
+ assert(dnaComplement("A") == "U");
29
+
30
+ assert(dnaComplement("ACGTGGTCTTAA") == "UGCACCAGAAUU");
31
+
32
+ assertThrown(dnaComplement("U"));
33
+ assertThrown(dnaComplement("XXX"));
34
+ assertThrown(dnaComplement("ACGTXXXCTTAA"));
35
+ }
36
+
37
+ void main () {}
@@ -27,52 +27,38 @@
27
27
  "scripts": {
28
28
  "test": "jest --no-cache ./*",
29
29
  "watch": "jest --no-cache --watch ./*",
30
- "lint": "eslint *.js; exit 0;",
31
- "lint-test": "eslint *.js && jest --no-cache ./* "
30
+ "lint": "eslint .",
31
+ "lint-test": "eslint . && jest --no-cache ./* "
32
32
  },
33
33
  "eslintConfig": {
34
34
  "parserOptions": {
35
35
  "ecmaVersion": 6,
36
36
  "sourceType": "module"
37
37
  },
38
+ "env": {
39
+ "es6": true,
40
+ "node": true,
41
+ "jasmine": true
42
+ },
43
+ "extends": "eslint:recommended",
38
44
  "rules": {
39
- "comma-dangle": [
40
- 2,
41
- "never"
42
- ],
43
- "no-cond-assign": [
44
- 2,
45
- "always"
46
- ],
47
- "no-console": 2,
48
- "no-constant-condition": 2,
49
- "no-control-regex": 2,
50
- "no-debugger": 2,
51
- "no-dupe-args": 2,
52
- "no-dupe-keys": 2,
53
- "no-duplicate-case": 2,
54
- "no-empty-character-class": 2,
55
- "no-empty": 2,
56
- "no-ex-assign": 2,
57
- "no-extra-boolean-cast": 2,
58
- "no-extra-parens": 2,
59
- "no-extra-semi": 2,
60
- "no-func-assign": 2,
61
- "no-inner-declarations": [
62
- 2,
63
- "both"
64
- ],
65
- "no-invalid-regexp": 2,
66
- "no-irregular-whitespace": 2,
67
- "no-negated-in-lhs": 2,
68
- "no-obj-calls": 2,
69
- "no-regex-spaces": 2,
70
- "no-sparse-arrays": 2,
71
- "no-unexpected-multiline": 2,
72
- "no-unreachable": 2,
73
- "use-isnan": 2,
74
- "valid-jsdoc": 2,
75
- "valid-typeof": 2
45
+ "indent": [ "off", 2 ],
46
+ "block-scoped-var": "off",
47
+ "radix": "off",
48
+ "no-use-before-define": "off",
49
+ "one-var": [ "off", "always" ],
50
+ "quotes": [ "off", "single", { "avoidEscape": true } ],
51
+ "semi": [ "off", "always" ],
52
+ "semi-spacing": [ "off", { "before": false, "after": true } ],
53
+ "no-whitespace-before-property": "off",
54
+ "space-before-blocks": [ "off", "always" ],
55
+ "space-before-function-paren": [ "off", { "anonymous": "always", "named": "never" } ],
56
+ "keyword-spacing": [ "off", { "before": true, "after": true } ],
57
+ "no-multi-spaces": "off",
58
+ "no-trailing-spaces": "off",
59
+ "curly": [ "error", "all" ],
60
+ "brace-style": [ "error", "1tbs", { "allowSingleLine": true } ],
61
+ "object-curly-spacing": [ "off", "always" ]
76
62
  }
77
63
  },
78
64
  "licenses": [
@@ -27,52 +27,38 @@
27
27
  "scripts": {
28
28
  "test": "jest --no-cache ./*",
29
29
  "watch": "jest --no-cache --watch ./*",
30
- "lint": "eslint *.js; exit 0;",
31
- "lint-test": "eslint *.js && jest --no-cache ./* "
30
+ "lint": "eslint .",
31
+ "lint-test": "eslint . && jest --no-cache ./* "
32
32
  },
33
33
  "eslintConfig": {
34
34
  "parserOptions": {
35
35
  "ecmaVersion": 6,
36
36
  "sourceType": "module"
37
37
  },
38
+ "env": {
39
+ "es6": true,
40
+ "node": true,
41
+ "jasmine": true
42
+ },
43
+ "extends": "eslint:recommended",
38
44
  "rules": {
39
- "comma-dangle": [
40
- 2,
41
- "never"
42
- ],
43
- "no-cond-assign": [
44
- 2,
45
- "always"
46
- ],
47
- "no-console": 2,
48
- "no-constant-condition": 2,
49
- "no-control-regex": 2,
50
- "no-debugger": 2,
51
- "no-dupe-args": 2,
52
- "no-dupe-keys": 2,
53
- "no-duplicate-case": 2,
54
- "no-empty-character-class": 2,
55
- "no-empty": 2,
56
- "no-ex-assign": 2,
57
- "no-extra-boolean-cast": 2,
58
- "no-extra-parens": 2,
59
- "no-extra-semi": 2,
60
- "no-func-assign": 2,
61
- "no-inner-declarations": [
62
- 2,
63
- "both"
64
- ],
65
- "no-invalid-regexp": 2,
66
- "no-irregular-whitespace": 2,
67
- "no-negated-in-lhs": 2,
68
- "no-obj-calls": 2,
69
- "no-regex-spaces": 2,
70
- "no-sparse-arrays": 2,
71
- "no-unexpected-multiline": 2,
72
- "no-unreachable": 2,
73
- "use-isnan": 2,
74
- "valid-jsdoc": 2,
75
- "valid-typeof": 2
45
+ "indent": [ "off", 2 ],
46
+ "block-scoped-var": "off",
47
+ "radix": "off",
48
+ "no-use-before-define": "off",
49
+ "one-var": [ "off", "always" ],
50
+ "quotes": [ "off", "single", { "avoidEscape": true } ],
51
+ "semi": [ "off", "always" ],
52
+ "semi-spacing": [ "off", { "before": false, "after": true } ],
53
+ "no-whitespace-before-property": "off",
54
+ "space-before-blocks": [ "off", "always" ],
55
+ "space-before-function-paren": [ "off", { "anonymous": "always", "named": "never" } ],
56
+ "keyword-spacing": [ "off", { "before": true, "after": true } ],
57
+ "no-multi-spaces": "off",
58
+ "no-trailing-spaces": "off",
59
+ "curly": [ "error", "all" ],
60
+ "brace-style": [ "error", "1tbs", { "allowSingleLine": true } ],
61
+ "object-curly-spacing": [ "off", "always" ]
76
62
  }
77
63
  },
78
64
  "licenses": [