trackler 2.2.1.35 → 2.2.1.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/c/exercises/all-your-base/test/test_all_your_base.c +5 -5
  4. data/tracks/clojure/config.json +10 -0
  5. data/tracks/clojure/exercises/series/README.md +28 -0
  6. data/tracks/clojure/exercises/series/project.clj +4 -0
  7. data/tracks/clojure/exercises/series/src/example.clj +9 -0
  8. data/tracks/clojure/exercises/series/src/series.clj +3 -0
  9. data/tracks/clojure/exercises/series/test/series_test.clj +23 -0
  10. data/tracks/coldfusion/README.md +2 -2
  11. data/tracks/coldfusion/config.json +28 -11
  12. data/tracks/coldfusion/docs/EXERCISE_README_INSERT.md +1 -1
  13. data/tracks/coldfusion/docs/TESTS.md +1 -1
  14. data/tracks/coldfusion/exercises/bob/.meta/HINTS.md +0 -0
  15. data/tracks/coldfusion/exercises/bob/Bob.cfc +13 -0
  16. data/tracks/coldfusion/exercises/bob/BobTest.cfc +115 -0
  17. data/tracks/coldfusion/exercises/bob/Solution.cfc +27 -0
  18. data/tracks/coldfusion/exercises/bob/SolutionTest.cfc +7 -0
  19. data/tracks/coldfusion/exercises/bob/TestRunner.cfc +103 -0
  20. data/tracks/coldfusion/exercises/bob/box.json +8 -0
  21. data/tracks/coldfusion/exercises/bob/index.cfm +37 -0
  22. data/tracks/coldfusion/exercises/word-count/.meta/HINTS.md +0 -0
  23. data/tracks/coldfusion/exercises/word-count/Solution.cfc +22 -0
  24. data/tracks/coldfusion/exercises/word-count/SolutionTest.cfc +7 -0
  25. data/tracks/coldfusion/exercises/word-count/TestRunner.cfc +103 -0
  26. data/tracks/coldfusion/exercises/word-count/WordCount.cfc +13 -0
  27. data/tracks/coldfusion/exercises/word-count/WordCountTest.cfc +55 -0
  28. data/tracks/coldfusion/exercises/word-count/box.json +8 -0
  29. data/tracks/coldfusion/exercises/word-count/index.cfm +37 -0
  30. data/tracks/coldfusion/tasks/ScaffoldExercise.cfc +1 -1
  31. data/tracks/coldfusion/tasks/TestAllSolutions.cfc +1 -1
  32. data/tracks/haskell/config.json +9 -0
  33. data/tracks/haskell/exercises/isogram/README.md +73 -0
  34. data/tracks/haskell/exercises/isogram/examples/success-standard/package.yaml +16 -0
  35. data/tracks/haskell/exercises/isogram/examples/success-standard/src/Isogram.hs +7 -0
  36. data/tracks/haskell/exercises/isogram/package.yaml +20 -0
  37. data/tracks/haskell/exercises/isogram/src/Isogram.hs +4 -0
  38. data/tracks/haskell/exercises/isogram/stack.yaml +1 -0
  39. data/tracks/haskell/exercises/isogram/test/Tests.hs +63 -0
  40. data/tracks/typescript/Makefile +15 -4
  41. data/tracks/typescript/common/package.json +1 -1
  42. data/tracks/typescript/exercises/acronym/package.json +1 -1
  43. data/tracks/typescript/exercises/anagram/anagram.ts +0 -0
  44. data/tracks/typescript/exercises/anagram/package.json +1 -1
  45. data/tracks/typescript/exercises/beer-song/beer-song.ts +0 -0
  46. data/tracks/typescript/exercises/beer-song/package.json +1 -1
  47. data/tracks/typescript/exercises/bob/bob.ts +0 -0
  48. data/tracks/typescript/exercises/bob/package.json +1 -1
  49. data/tracks/typescript/exercises/difference-of-squares/difference-of-squares.ts +0 -0
  50. data/tracks/typescript/exercises/difference-of-squares/package.json +1 -1
  51. data/tracks/typescript/exercises/etl/etl.ts +0 -0
  52. data/tracks/typescript/exercises/etl/package.json +1 -1
  53. data/tracks/typescript/exercises/food-chain/food-chain.ts +0 -0
  54. data/tracks/typescript/exercises/food-chain/package.json +1 -1
  55. data/tracks/typescript/exercises/gigasecond/gigasecond.ts +0 -0
  56. data/tracks/typescript/exercises/gigasecond/package.json +1 -1
  57. data/tracks/typescript/exercises/grade-school/grade-school.ts +0 -0
  58. data/tracks/typescript/exercises/grade-school/package.json +1 -1
  59. data/tracks/typescript/exercises/hamming/hamming.ts +0 -0
  60. data/tracks/typescript/exercises/hamming/package.json +1 -1
  61. data/tracks/typescript/exercises/hello-world/hello-world.ts +0 -0
  62. data/tracks/typescript/exercises/hello-world/package.json +1 -1
  63. data/tracks/typescript/exercises/leap/leap.ts +0 -0
  64. data/tracks/typescript/exercises/leap/package.json +1 -1
  65. data/tracks/typescript/exercises/pangram/package.json +1 -1
  66. data/tracks/typescript/exercises/pangram/pangram.ts +0 -0
  67. data/tracks/typescript/exercises/phone-number/package.json +1 -1
  68. data/tracks/typescript/exercises/phone-number/phone-number.ts +0 -0
  69. data/tracks/typescript/exercises/raindrops/package.json +1 -1
  70. data/tracks/typescript/exercises/raindrops/raindrops.ts +0 -0
  71. data/tracks/typescript/exercises/rna-transcription/package.json +1 -1
  72. data/tracks/typescript/exercises/rna-transcription/rna-transcription.ts +0 -0
  73. data/tracks/typescript/exercises/robot-name/package.json +1 -1
  74. data/tracks/typescript/exercises/robot-name/robot-name.ts +0 -0
  75. data/tracks/typescript/exercises/say/package.json +1 -1
  76. data/tracks/typescript/exercises/say/say.ts +0 -0
  77. data/tracks/typescript/exercises/scrabble-score/package.json +1 -1
  78. data/tracks/typescript/exercises/scrabble-score/scrabble-score.ts +0 -0
  79. data/tracks/typescript/exercises/space-age/package.json +1 -1
  80. data/tracks/typescript/exercises/space-age/space-age.ts +0 -0
  81. data/tracks/typescript/exercises/word-count/package.json +1 -1
  82. data/tracks/typescript/exercises/word-count/word-count.ts +0 -0
  83. data/tracks/typescript/exercises/wordy/package.json +1 -1
  84. data/tracks/typescript/exercises/wordy/wordy.ts +0 -0
  85. metadata +51 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25d3a92dd75a43d8f4a6a449411bd76ba1a3a314
4
- data.tar.gz: 47be5e25d79f8d872dcb60aad896ce31a899ec66
3
+ metadata.gz: faac08c981ca8b1818972ee26618ed44e56105fd
4
+ data.tar.gz: b65e1ce9ee9813c786e34f6491aa89ee94a2ce77
5
5
  SHA512:
6
- metadata.gz: 83a4a2144c5b8f37d7e757c200a8aa37637456b6bd86f198b9cce574e1998087c3e312fa50ba9a8640c987b5674cbd36c6022bc0148a43da7861bceaea8d1be1
7
- data.tar.gz: 98ba226199288622a60349efcff70010118f5d2afac6901d061f53d22cee1c223d4eda7e6ee05a04484afa7d444eaa7830f98e450c7919c7eec36ce1cee63c28
6
+ metadata.gz: 438a77259fe83ef17635fb743bc1148615568deff93f5aef23b933b6cd52c974c8f22c3afe37ffce8cabf3b16b941890d6216b479e6a30e564d71b7b75cd3f40
7
+ data.tar.gz: b5e5bae54e3a77d882d93a3b936f37de75b7aa4cd0700e7616435147150a5c64f3d61019bb3775fd989d44e7cf3e1267ee13a6be02e9d3a49193e3b9bb6ad551
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.35"
2
+ VERSION = "2.2.1.36"
3
3
  end
@@ -15,8 +15,8 @@ void copy_array(int8_t src[], int8_t dest[DIGITS_ARRAY_SIZE], size_t n)
15
15
  dest[i] = src[i];
16
16
  }
17
17
 
18
- void test_rebase(uint16_t input_base, int8_t input_digits[],
19
- size_t input_length, uint16_t output_base,
18
+ void test_rebase(int16_t input_base, int8_t input_digits[],
19
+ size_t input_length, int16_t output_base,
20
20
  int8_t expected_digits[], size_t expected_length)
21
21
  {
22
22
  int8_t digits[DIGITS_ARRAY_SIZE] = { 0 };
@@ -30,7 +30,7 @@ void test_rebase(uint16_t input_base, int8_t input_digits[],
30
30
  TEST_ASSERT_EQUAL_INT32(expected_length, actual_length);
31
31
 
32
32
  if (expected_length > 0)
33
- TEST_ASSERT_EQUAL_INT16_ARRAY(ex_digits, digits, expected_length);
33
+ TEST_ASSERT_EQUAL_INT8_ARRAY(ex_digits, digits, expected_length);
34
34
  }
35
35
 
36
36
  void test_single_bit_to_decimal(void)
@@ -133,9 +133,9 @@ void test_first_base_is_negative(void)
133
133
 
134
134
  void test_negative_digit(void)
135
135
  {
136
- int8_t input[] = { 1 };
136
+ int8_t input[] = { 1, -1, 1, 0, 1, 0 };
137
137
  int8_t expected[] = { 0 };
138
- test_rebase(-2, input, LENGTH(input), 10, expected, 0);
138
+ test_rebase(2, input, LENGTH(input), 10, expected, 0);
139
139
  }
140
140
 
141
141
  void test_invalid_positive_digit(void)
@@ -75,6 +75,16 @@
75
75
 
76
76
  ]
77
77
  },
78
+ {
79
+ "uuid": "c34af548-c5f6-43a9-84e2-c4166605fc8e",
80
+ "slug": "series",
81
+ "core": false,
82
+ "unlocked_by": null,
83
+ "difficulty": 1,
84
+ "topics": [
85
+
86
+ ]
87
+ },
78
88
  {
79
89
  "uuid": "66d97ae9-36ac-47c6-8b9f-e77ce498fc70",
80
90
  "slug": "nucleotide-count",
@@ -0,0 +1,28 @@
1
+ # Series
2
+
3
+ Given a string of digits, output all the contiguous substrings of length `n` in
4
+ that string.
5
+
6
+ For example, the string "49142" has the following 3-digit series:
7
+
8
+ - 491
9
+ - 914
10
+ - 142
11
+
12
+ And the following 4-digit series:
13
+
14
+ - 4914
15
+ - 9142
16
+
17
+ And if you ask for a 6-digit series from a 5-digit string, you deserve
18
+ whatever you get.
19
+
20
+ Note that these series are only required to occupy *adjacent positions*
21
+ in the input; the digits need not be *numerically consecutive*.
22
+
23
+ ## Source
24
+
25
+ See more at [http://projecteuler.net/problem=8](http://projecteuler.net/problem=8)
26
+
27
+ ## Submitting Incomplete Solutions
28
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,4 @@
1
+ (defproject series "0.1.0-SNAPSHOT"
2
+ :description "series exercise"
3
+ :url "https://github.com/exercism/xclojure/tree/master/exercises/series"
4
+ :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -0,0 +1,9 @@
1
+ (ns series)
2
+
3
+ (defn slices [string n]
4
+ (if (zero? n)
5
+ [""]
6
+ (loop [string string, acc []]
7
+ (if (< (count string) n)
8
+ acc
9
+ (recur (rest string) (conj acc (apply str (take n string))))))))
@@ -0,0 +1,3 @@
1
+ (ns series)
2
+
3
+ (defn slices [string n])
@@ -0,0 +1,23 @@
1
+ (ns series-test
2
+ (require [clojure.test :refer [deftest is testing]]
3
+ [series :refer [slices]]))
4
+
5
+ (deftest empty-string
6
+ (testing "empty string with any number"
7
+ (is (= [] (slices "" 1)))))
8
+
9
+ (deftest number-eq-zero
10
+ (testing "number = 0"
11
+ (is (= [""] (slices "123" 0)))))
12
+
13
+ (deftest number>string
14
+ (testing "number > string-length"
15
+ (is (= [] (slices "123" 1000)))))
16
+
17
+ (deftest number=string
18
+ (testing "number = string-length"
19
+ (is (= ["123"] (slices "123" 3)))))
20
+
21
+ (deftest number<string
22
+ (testing "number < string-length"
23
+ (is (= #{"123" "234" "345"} (set (slices "12345" 3))))))
@@ -40,13 +40,13 @@ To run the test for a given exercise, `cd` into the folder and run the following
40
40
  ```bash
41
41
  box task run TestRunner
42
42
  # Or start up a test watcher that will rerun when files change
43
- box task run TestRunner --watcher
43
+ box task run TestRunner --:watcher
44
44
  ```
45
45
 
46
46
  If you want to run the test suite against the solution:
47
47
 
48
48
  ```bash
49
- box task run TestRunner --solution
49
+ box task run TestRunner --:solution
50
50
  ```
51
51
 
52
52
  The tests leverage a library called TestBox which supports xUnit and BDD style of testing. All test suites will be written in the [BDD style](https://testbox.ortusbooks.com/content/primers/bdd/specs.html) which uses closures to define test specs. You won't need to worry about installing TestBox. The CLI test runner will take care of that for you. You just need to be connected to the internet the first time you run it. You can read more about it here:
@@ -1,18 +1,19 @@
1
1
  {
2
- "language": "ColdFusion",
3
- "blurb" : "ColdFusion (CFML) is an open source and commercial (JIT) compiled dynamic and loosely typed JVM scripting language that embodies classic OO, and functional programming, making it easy to learn, fun to use. CFML brings the power and scalability of the J2EE ecosystem but without the boilerplate of Java.",
4
- "active": true,
5
- "test_pattern": "Test.cfc",
6
- "solution_pattern": "Solution.cfc",
7
- "ignore_pattern": "Solution",
8
- "foregone": [
2
+ "language":"ColdFusion",
3
+ "blurb":"ColdFusion (CFML) is an open source and commercial (JIT) compiled dynamic and loosely typed JVM scripting language that embodies classic OO, and functional programming, making it easy to learn, fun to use. CFML brings the power and scalability of the J2EE ecosystem but without the boilerplate of Java.",
4
+ "active":true,
5
+ "test_pattern":"Test.cfc",
6
+ "solution_pattern":"Solution.cfc",
7
+ "ignore_pattern":"Solution",
8
+ "foregone":[
9
+
9
10
  ],
10
11
  "exercises":[
11
12
  {
12
- "uuid": "ab04a390-0969-4a17-8081-c852b23ed88c",
13
- "difficulty": 1,
14
- "slug": "hello-world",
15
- "topics": [
13
+ "uuid":"ab04a390-0969-4a17-8081-c852b23ed88c",
14
+ "difficulty":1,
15
+ "slug":"hello-world",
16
+ "topics":[
16
17
 
17
18
  ]
18
19
  },
@@ -200,6 +201,22 @@
200
201
  "uuid":"FC8922A3-E29D-451D-9947-A2781C0FF787",
201
202
  "topics":[
202
203
 
204
+ ]
205
+ },
206
+ {
207
+ "difficulty":1,
208
+ "slug":"bob",
209
+ "uuid":"12BBECF4-93EB-40F2-AC13-8CF28B550F0A",
210
+ "topics":[
211
+
212
+ ]
213
+ },
214
+ {
215
+ "difficulty":1,
216
+ "slug":"word-count",
217
+ "uuid":"C61E97BE-6C66-4F1F-87ED-D21C4ED2A8E2",
218
+ "topics":[
219
+
203
220
  ]
204
221
  }
205
222
  ]
@@ -7,7 +7,7 @@ To run the tests, `cd` into the exercise folder and run the following:
7
7
  ```bash
8
8
  box task run TestRunner
9
9
  # Or start up a test watcher that will rerun when files change
10
- box task run TestRunner --watcher
10
+ box task run TestRunner --:watcher
11
11
  ```
12
12
 
13
13
  The tests leverage a library called TestBox which supports xUnit and BDD style of testing. All test suites will be written in the [BDD style](https://testbox.ortusbooks.com/content/primers/bdd/specs.html) which uses closures to define test specs. You won't need to worry about installing TestBox. The CLI test runner will take care of that for you. You just need to be connected to the internet the first time you run it. You can read more about it here:
@@ -5,7 +5,7 @@ To run the test for a given exercise, `cd` into the folder and run the following
5
5
  ```bash
6
6
  box task run TestRunner
7
7
  # Or start up a test watcher that will rerun when files change
8
- box task run TestRunner --watcher
8
+ box task run TestRunner --:watcher
9
9
  ```
10
10
 
11
11
  The tests leverage a library called TestBox which supports xUnit and BDD style of testing. All test suites will be written in the [BDD style](https://testbox.ortusbooks.com/content/primers/bdd/specs.html) which uses closures to define test specs. You won't need to worry about installing TestBox. The CLI test runner will take care of that for you. You just need to be connected to the internet the first time you run it. You can read more about it here:
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Your implmentation of the Bob exercise
3
+ */
4
+ component {
5
+
6
+ /**
7
+ * @returns
8
+ */
9
+ function response( input ) {
10
+ // Implement me here
11
+ }
12
+
13
+ }
@@ -0,0 +1,115 @@
1
+ component extends="testbox.system.BaseSpec" {
2
+
3
+ function beforeAll(){
4
+ SUT = createObject( 'Bob' );
5
+ }
6
+
7
+ function run(){
8
+
9
+ describe( "My Bob class", function(){
10
+
11
+ it( 'stating something', function(){
12
+ expect( SUT.response( input='Tom-ay-to, tom-aaaah-to.' ) ).toBe( 'Whatever.' );
13
+ });
14
+
15
+ it( 'shouting', function(){
16
+ expect( SUT.response( input='WATCH OUT!' ) ).toBe( 'Whoa, chill out!' );
17
+ });
18
+
19
+ it( 'shouting gibberish', function(){
20
+ expect( SUT.response( input='FCECDFCAAB' ) ).toBe( 'Whoa, chill out!' );
21
+ });
22
+
23
+ it( 'asking a question', function(){
24
+ expect( SUT.response( input='Does this cryogenic chamber make me look fat?' ) ).toBe( 'Sure.' );
25
+ });
26
+
27
+ it( 'asking a numeric question', function(){
28
+ expect( SUT.response( input='You are, what, like 15?' ) ).toBe( 'Sure.' );
29
+ });
30
+
31
+ it( 'asking gibberish', function(){
32
+ expect( SUT.response( input='fffbbcbeab?' ) ).toBe( 'Sure.' );
33
+ });
34
+
35
+ it( 'talking forcefully', function(){
36
+ expect( SUT.response( input='Let''s go make out behind the gym!' ) ).toBe( 'Whatever.' );
37
+ });
38
+
39
+ it( 'using acronyms in regular speech', function(){
40
+ expect( SUT.response( input='It''s OK if you don''t want to go to the DMV.' ) ).toBe( 'Whatever.' );
41
+ });
42
+
43
+ it( 'forceful question', function(){
44
+ expect( SUT.response( input='WHAT THE HELL WERE YOU THINKING?' ) ).toBe( 'Whoa, chill out!' );
45
+ });
46
+
47
+ it( 'shouting numbers', function(){
48
+ expect( SUT.response( input='1, 2, 3 GO!' ) ).toBe( 'Whoa, chill out!' );
49
+ });
50
+
51
+ it( 'only numbers', function(){
52
+ expect( SUT.response( input='1, 2, 3' ) ).toBe( 'Whatever.' );
53
+ });
54
+
55
+ it( 'question with only numbers', function(){
56
+ expect( SUT.response( input='4?' ) ).toBe( 'Sure.' );
57
+ });
58
+
59
+ it( 'shouting with special characters', function(){
60
+ expect( SUT.response( input='ZOMG THE %^*@##$(*^ ZOMBIES ARE COMING!!11!!1!' ) ).toBe( 'Whoa, chill out!' );
61
+ });
62
+
63
+ it( 'shouting with no exclamation mark', function(){
64
+ expect( SUT.response( input='I HATE YOU' ) ).toBe( 'Whoa, chill out!' );
65
+ });
66
+
67
+ it( 'statement containing question mark', function(){
68
+ expect( SUT.response( input='Ending with ? means a question.' ) ).toBe( 'Whatever.' );
69
+ });
70
+
71
+ it( 'non-letters with question', function(){
72
+ expect( SUT.response( input=':) ?' ) ).toBe( 'Sure.' );
73
+ });
74
+
75
+ it( 'prattling on', function(){
76
+ expect( SUT.response( input='Wait! Hang on. Are you going to be OK?' ) ).toBe( 'Sure.' );
77
+ });
78
+
79
+ it( 'silence', function(){
80
+ expect( SUT.response( input='' ) ).toBe( 'Fine. Be that way!' );
81
+ });
82
+
83
+ it( 'prolonged silence', function(){
84
+ expect( SUT.response( input=' ' ) ).toBe( 'Fine. Be that way!' );
85
+ });
86
+
87
+ it( 'alternate silence', function(){
88
+ expect( SUT.response( input=' ' ) ).toBe( 'Fine. Be that way!' );
89
+ });
90
+
91
+ it( 'multiple line question', function(){
92
+ expect( SUT.response( input='#chr( 10 )#Does this cryogenic chamber make me look fat?#chr( 10 )#no' ) ).toBe( 'Whatever.' );
93
+ });
94
+
95
+ it( 'starting with whitespace', function(){
96
+ expect( SUT.response( input=' hmmmmmmm...' ) ).toBe( 'Whatever.' );
97
+ });
98
+
99
+ it( 'ending with whitespace', function(){
100
+ expect( SUT.response( input='Okay if like my spacebar quite a bit? ' ) ).toBe( 'Sure.' );
101
+ });
102
+
103
+ it( 'other whitespace', function(){
104
+ expect( SUT.response( input='#chr( 10 )##chr( 13 )# ' ) ).toBe( 'Fine. Be that way!' );
105
+ });
106
+
107
+ it( 'non-question ending with whitespace', function(){
108
+ expect( SUT.response( input='This is a statement ending with whitespace ' ) ).toBe( 'Whatever.' );
109
+ });
110
+
111
+ });
112
+
113
+ }
114
+
115
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Here is an example solution for the Bob exercise
3
+ */
4
+ component {
5
+
6
+ function response( input ) {
7
+ input = input
8
+ .trim()
9
+ .reReplaceNoCase( '[^a-z?]', '' );
10
+
11
+ if( !input.len() ) {
12
+ return 'Fine. Be that way!';
13
+ }
14
+
15
+ if( input.reFindNoCase( '[a-z]' ) && compare( input, input.uCase() ) == 0 ) {
16
+ return 'Whoa, chill out!';
17
+ }
18
+
19
+ if( input.right( 1 ) == '?' ) {
20
+ return 'Sure.';
21
+ }
22
+
23
+ return 'Whatever.';
24
+
25
+ }
26
+
27
+ }
@@ -0,0 +1,7 @@
1
+ component extends="BobTest" {
2
+
3
+ function beforeAll(){
4
+ SUT = createObject( 'Solution' );
5
+ }
6
+
7
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * I am a CommandBox task runner which you can use to test your implementation of this exercise against the
3
+ * provided test suite. To use me, open the CommandBox CLI and run this:
4
+ *
5
+ * CommandBox> task run TestRunner
6
+ *
7
+ * To start up a test watcher that will automatically rerun the test suite every time you save a file change, run this:
8
+ *
9
+ * CommandBox> task run TestRunner --watcher
10
+ *
11
+ */
12
+ component {
13
+
14
+ /**
15
+ * @solution Runs the tests against the solution
16
+ * @watcher Start up a file watch that re-runs the tests on file changes. Use Ctrl-C to stop
17
+ */
18
+ function run( boolean solution=false, boolean watcher=false ) {
19
+
20
+ ensureTestBox();
21
+
22
+ if( watcher ) {
23
+
24
+ // Tabula rasa
25
+ command( 'cls' ).run();
26
+
27
+ // Start watcher
28
+ watch()
29
+ .paths( '*.cfc' )
30
+ .inDirectory( getCWD() )
31
+ .withDelay( 500 )
32
+ .onChange( function() {
33
+
34
+ // Clear the screen
35
+ command( 'cls' )
36
+ .run();
37
+
38
+ // This is neccessary so changes to tests get picked up right away.
39
+ pagePoolClear();
40
+
41
+ runTests( solution );
42
+
43
+ } )
44
+ .start();
45
+
46
+ } else {
47
+ runTests( solution );
48
+ }
49
+
50
+ }
51
+
52
+ /**
53
+ * Make sure the TestBox framework is installed
54
+ */
55
+ private function ensureTestBox() {
56
+ var excerciseRoot = getCWD();
57
+ var testBoxRoot = excerciseRoot & '/testbox';
58
+
59
+ if( !directoryExists( testBoxRoot ) ) {
60
+
61
+ print.boldYellowLine( 'Installing some missing dependencies for you!' ).toConsole();
62
+ command( 'install' )
63
+ .inWorkingDirectory( excerciseRoot )
64
+ .run();
65
+ }
66
+
67
+ // Bootstrap TestBox framework
68
+ filesystemUtil.createMapping( '/testbox', testBoxRoot );
69
+ }
70
+
71
+ /**
72
+ * Invoke TestBox to run the test suite
73
+ */
74
+ private function runTests( boolean solution=false ) {
75
+
76
+ // Create TestBox and run the tests
77
+ testData = new testbox.system.TestBox()
78
+ .runRaw( directory = {
79
+ // Find all CFCs...
80
+ mapping = filesystemUtil.makePathRelative( getCWD() ),
81
+ // ... in this directory ...
82
+ recurse = false,
83
+ // ... whose name ends in "test"
84
+ filter = function( path ) {
85
+ return path.reFind( ( solution ? 'Solution' : '' ) & 'Test.cfc$' );
86
+ }
87
+ } )
88
+ .getMemento();
89
+
90
+ // Print out the results with ANSI formatting for the CLI
91
+ getInstance( 'CLIRenderer@testbox-commands' )
92
+ .render( print, testData, true );
93
+
94
+ print.toConsole();
95
+
96
+ // Set proper exit code
97
+ if( testData.totalFail || testData.totalError ) {
98
+ setExitCode( 1 );
99
+ }
100
+ }
101
+
102
+ }
103
+