trackler 2.0.6.36 → 2.0.6.37

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,16 +3,63 @@
3
3
  use Test;
4
4
  use JSON::Tiny;
5
5
 
6
- use lib ( my $dir = IO::Path.new($?FILE).parent ).path;
6
+ use lib $?FILE.IO.dirname;
7
7
 
8
8
  my $module = %*ENV<EXERCISM> ?? 'Example' !! 'SpaceAge';
9
9
  require ::($module) <&age-on>;
10
10
 
11
11
  plan 8;
12
12
 
13
- my %testcase = from-json $dir.child('cases.json').slurp;
14
-
15
- for |%testcase{'age on'}{'cases'} -> %case {
13
+ for my @cases -> %case {
16
14
  is age-on( |%case<planet seconds>), %case{'expected'},
17
15
  %case<planet seconds>.gist;
18
16
  }
17
+
18
+ done-testing;
19
+
20
+ INIT {
21
+ @cases := from-json 「
22
+ [
23
+ {
24
+ "planet": "Earth",
25
+ "seconds": 1000000000,
26
+ "expected": 31.69
27
+ },
28
+ {
29
+ "planet": "Mercury",
30
+ "seconds": 2134835688,
31
+ "expected": 280.88
32
+ },
33
+ {
34
+ "planet": "Venus",
35
+ "seconds": 189839836,
36
+ "expected": 9.78
37
+ },
38
+ {
39
+ "planet": "Mars",
40
+ "seconds": 2329871239,
41
+ "expected": 39.25
42
+ },
43
+ {
44
+ "planet": "Jupiter",
45
+ "seconds": 901876382,
46
+ "expected": 2.41
47
+ },
48
+ {
49
+ "planet": "Saturn",
50
+ "seconds": 3000000000,
51
+ "expected": 3.23
52
+ },
53
+ {
54
+ "planet": "Uranus",
55
+ "seconds": 3210123456,
56
+ "expected": 1.21
57
+ },
58
+ {
59
+ "planet": "Neptune",
60
+ "seconds": 8210123456,
61
+ "expected": 1.58
62
+ }
63
+ ]
64
+
65
+ }
@@ -3,16 +3,14 @@
3
3
  use Test;
4
4
  use JSON::Tiny;
5
5
 
6
- use lib ( my $dir = IO::Path.new($?FILE).parent ).path;
6
+ use lib $?FILE.IO.dirname;
7
7
 
8
8
  my $module = %*ENV<EXERCISM> ?? 'Example' !! 'Wordy';
9
9
  require ::($module) <&answer>;
10
10
 
11
11
  plan 16;
12
12
 
13
- my %cases = from-json $dir.child('cases.json').slurp;
14
-
15
- for |%cases<cases> -> %case {
13
+ for my @cases -> %case {
16
14
  with %case<expected> {
17
15
  is answer(%case<input>), |%case<expected description>
18
16
  or diag 'input: ' ~ %case<input>;
@@ -22,3 +20,92 @@ for |%cases<cases> -> %case {
22
20
  or diag 'input: ' ~ %case<input>;
23
21
  }
24
22
  }
23
+
24
+ done-testing;
25
+
26
+ INIT {
27
+ @cases := from-json 「
28
+ [
29
+ {
30
+ "description": "addition",
31
+ "input": "What is 1 plus 1?",
32
+ "expected": 2
33
+ },
34
+ {
35
+ "description": "more addition",
36
+ "input": "What is 53 plus 2?",
37
+ "expected": 55
38
+ },
39
+ {
40
+ "description": "addition with negative numbers",
41
+ "input": "What is -1 plus -10?",
42
+ "expected": -11
43
+ },
44
+ {
45
+ "description": "large addition",
46
+ "input": "What is 123 plus 45678?",
47
+ "expected": 45801
48
+ },
49
+ {
50
+ "description": "subtraction",
51
+ "input": "What is 4 minus -12?",
52
+ "expected": 16
53
+ },
54
+ {
55
+ "description": "multiplication",
56
+ "input": "What is -3 multiplied by 25?",
57
+ "expected": -75
58
+ },
59
+ {
60
+ "description": "division",
61
+ "input": "What is 33 divided by -3?",
62
+ "expected": -11
63
+ },
64
+ {
65
+ "description": "multiple additions",
66
+ "input": "What is 1 plus 1 plus 1?",
67
+ "expected": 3
68
+ },
69
+ {
70
+ "description": "addition and subtraction",
71
+ "input": "What is 1 plus 5 minus -2?",
72
+ "expected": 8
73
+ },
74
+ {
75
+ "description": "multiple subtraction",
76
+ "input": "What is 20 minus 4 minus 13?",
77
+ "expected": 3
78
+ },
79
+ {
80
+ "description": "subtraction then addition",
81
+ "input": "What is 17 minus 6 plus 3?",
82
+ "expected": 14
83
+ },
84
+ {
85
+ "description": "multiple multiplication",
86
+ "input": "What is 2 multiplied by -2 multiplied by 3?",
87
+ "expected": -12
88
+ },
89
+ {
90
+ "description": "addition and multiplication",
91
+ "input": "What is -3 plus 7 multiplied by -2?",
92
+ "expected": -8
93
+ },
94
+ {
95
+ "description": "multiple division",
96
+ "input": "What is -12 divided by 2 divided by -3?",
97
+ "expected": 2
98
+ },
99
+ {
100
+ "description": "unknown operation",
101
+ "input": "What is 52 cubed?",
102
+ "expected": null
103
+ },
104
+ {
105
+ "description": "Non math question",
106
+ "input": "Who is the President of the United States?",
107
+ "expected": null
108
+ }
109
+ ]
110
+
111
+ }
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.0.6.36
4
+ version: 2.0.6.37
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-02-10 00:00:00.000000000 Z
11
+ date: 2017-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -3002,6 +3002,10 @@ files:
3002
3002
  - tracks/go/exercises/etl/example.go
3003
3003
  - tracks/go/exercises/food-chain/example.go
3004
3004
  - tracks/go/exercises/food-chain/food_chain_test.go
3005
+ - tracks/go/exercises/forth/cases_test.go
3006
+ - tracks/go/exercises/forth/example.go
3007
+ - tracks/go/exercises/forth/example_gen.go
3008
+ - tracks/go/exercises/forth/forth_test.go
3005
3009
  - tracks/go/exercises/gigasecond/cases_test.go
3006
3010
  - tracks/go/exercises/gigasecond/example.go
3007
3011
  - tracks/go/exercises/gigasecond/example_gen.go
@@ -5669,12 +5673,10 @@ files:
5669
5673
  - tracks/perl6/exercises/accumulate/accumulate.t
5670
5674
  - tracks/perl6/exercises/allergies/Example.pm
5671
5675
  - tracks/perl6/exercises/allergies/allergies.t
5672
- - tracks/perl6/exercises/allergies/cases.json
5673
5676
  - tracks/perl6/exercises/anagram/Example.pm
5674
5677
  - tracks/perl6/exercises/anagram/anagram.t
5675
5678
  - tracks/perl6/exercises/atbash-cipher/Example.pm
5676
5679
  - tracks/perl6/exercises/atbash-cipher/atbash-cipher.t
5677
- - tracks/perl6/exercises/atbash-cipher/cases.json
5678
5680
  - tracks/perl6/exercises/binary/Example.pm
5679
5681
  - tracks/perl6/exercises/binary/binary.t
5680
5682
  - tracks/perl6/exercises/bob/Example.pm
@@ -5691,7 +5693,6 @@ files:
5691
5693
  - tracks/perl6/exercises/linked-list/Example.pm6
5692
5694
  - tracks/perl6/exercises/linked-list/linked-list.t
5693
5695
  - tracks/perl6/exercises/phone-number/Example.pm
5694
- - tracks/perl6/exercises/phone-number/cases.json
5695
5696
  - tracks/perl6/exercises/phone-number/phone-number.t
5696
5697
  - tracks/perl6/exercises/raindrops/Example.pm
5697
5698
  - tracks/perl6/exercises/raindrops/raindrops.t
@@ -5702,14 +5703,12 @@ files:
5702
5703
  - tracks/perl6/exercises/scrabble-score/Example.pm
5703
5704
  - tracks/perl6/exercises/scrabble-score/scrabble-score.t
5704
5705
  - tracks/perl6/exercises/space-age/Example.pm
5705
- - tracks/perl6/exercises/space-age/cases.json
5706
5706
  - tracks/perl6/exercises/space-age/space-age.t
5707
5707
  - tracks/perl6/exercises/trinary/Example.pm
5708
5708
  - tracks/perl6/exercises/trinary/trinary.t
5709
5709
  - tracks/perl6/exercises/word-count/Example.pm
5710
5710
  - tracks/perl6/exercises/word-count/word-count.t
5711
5711
  - tracks/perl6/exercises/wordy/Example.pm
5712
- - tracks/perl6/exercises/wordy/cases.json
5713
5712
  - tracks/perl6/exercises/wordy/wordy.t
5714
5713
  - tracks/perl6/img/icon.png
5715
5714
  - tracks/php/.editorconfig
@@ -1,109 +0,0 @@
1
- {
2
- "allergic_to": {
3
- "description": [
4
- "Given a number and a substance, indicate whether Tom is allergic ",
5
- "to that substance.",
6
- "Test cases for this method involve more than one assertion.",
7
- "Each case in 'expected' specifies what the method should return for",
8
- "the given substance."
9
- ],
10
- "cases": [
11
- {
12
- "description": "no allergies means not allergic",
13
- "score": 0,
14
- "expected": [
15
- {
16
- "substance": "peanuts",
17
- "result": false
18
- },
19
- {
20
- "substance": "cats",
21
- "result": false
22
- },
23
- {
24
- "substance": "strawberries",
25
- "result": false
26
- }
27
- ]
28
- },
29
- {
30
- "description": "is allergic to eggs",
31
- "score": 1,
32
- "expected": [
33
- {
34
- "substance": "eggs",
35
- "result": true
36
- }
37
- ]
38
- },
39
- {
40
- "description": "allergic to eggs in addition to other stuff",
41
- "score": 5,
42
- "expected": [
43
- {
44
- "substance": "eggs",
45
- "result": true
46
- },
47
- {
48
- "substance": "shellfish",
49
- "result": true
50
- },
51
- {
52
- "substance": "strawberries",
53
- "result": false
54
- }
55
- ]
56
- }
57
- ]
58
- },
59
- "list": {
60
- "description": ["Given a number, list all things Tom is allergic to"],
61
- "cases": [
62
- {
63
- "description": "no allergies at all",
64
- "score": 0,
65
- "expected": []
66
- },
67
- {
68
- "description": "allergic to just eggs",
69
- "score": 1,
70
- "expected": ["eggs"]
71
- },
72
- {
73
- "description": "allergic to just peanuts",
74
- "score": 2,
75
- "expected": ["peanuts"]
76
- },
77
- {
78
- "description": "allergic to just strawberries",
79
- "score": 8,
80
- "expected": ["strawberries"]
81
- },
82
- {
83
- "description": "allergic to eggs and peanuts",
84
- "score": 3,
85
- "expected": ["eggs", "peanuts"]
86
- },
87
- {
88
- "description": "allergic to more than eggs but not peanuts",
89
- "score": 5,
90
- "expected": ["eggs", "shellfish"]
91
- },
92
- {
93
- "description": "allergic to lots of stuff",
94
- "score": 248,
95
- "expected": ["strawberries", "tomatoes", "chocolate", "pollen", "cats"]
96
- },
97
- {
98
- "description": "allergic to everything",
99
- "score": 255,
100
- "expected": ["eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"]
101
- },
102
- {
103
- "description": "ignore non allergen score parts",
104
- "score": 509,
105
- "expected": ["eggs", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"]
106
- }
107
- ]
108
- }
109
- }
@@ -1,82 +0,0 @@
1
- {
2
- "#": [
3
- "The tests are divided into two groups: ",
4
- "* Encoding from English to atbash cipher",
5
- "* Decoding from atbash cipher to all-lowercase-mashed-together English"
6
- ],
7
- "encode": {
8
- "description": ["Test encoding from English to atbash"],
9
- "cases": [
10
- {
11
- "description": "encode yes",
12
- "phrase": "yes",
13
- "expected": "bvh"
14
- },
15
- {
16
- "description": "encode no",
17
- "phrase": "no",
18
- "expected": "ml"
19
- },
20
- {
21
- "description": "encode OMG",
22
- "phrase": "OMG",
23
- "expected": "lnt"
24
- },
25
- {
26
- "description": "encode spaces",
27
- "phrase": "O M G",
28
- "expected": "lnt"
29
- },
30
- {
31
- "description": "encode mindblowingly",
32
- "phrase": "mindblowingly",
33
- "expected": "nrmwy oldrm tob"
34
- },
35
- {
36
- "description": "encode numbers",
37
- "phrase": "Testing,1 2 3, testing.",
38
- "expected": "gvhgr mt123 gvhgr mt"
39
- },
40
- {
41
- "description": "encode deep thought",
42
- "phrase": "Truth is fiction.",
43
- "expected": "gifgs rhurx grlm"
44
- },
45
- {
46
- "description": "encode all the letters",
47
- "phrase": "The quick brown fox jumps over the lazy dog.",
48
- "expected": "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"
49
- },
50
- {
51
- "description": "encode ignores non ascii",
52
- "phrase": "non ascii éignored",
53
- "expected": "mlmzh xrrrt mlivw"
54
- }
55
- ]
56
- },
57
- "decode": {
58
- "description": ["Test decoding from atbash to English"],
59
- "cases": [
60
- {
61
- "description": "decode exercism",
62
- "phrase": "vcvix rhn",
63
- "expected": "exercism"
64
- },
65
- {
66
- "description": "decode a sentence",
67
- "phrase": "zmlyh gzxov rhlug vmzhg vkkrm thglm v",
68
- "expected": "anobstacleisoftenasteppingstone"
69
- },
70
- {
71
- "description": "decode numbers",
72
- "phrase": "gvhgr mt123 gvhgr mt",
73
- "expected": "testing123testing"
74
- },
75
- {
76
- "description": "decode all the letters",
77
- "phrase": "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt",
78
- "expected": "thequickbrownfoxjumpsoverthelazydog"
79
- }
80
- ]
81
- }
82
- }
@@ -1,47 +0,0 @@
1
- {
2
- "valid": [
3
- {
4
- "input": 1234567890,
5
- "number": "1234567890",
6
- "area-code": "123",
7
- "pretty": "(123) 456-7890",
8
- "test": "10 digit integer"
9
- },
10
- {
11
- "input": "+1 (234) 555-6789",
12
- "number": "2345556789",
13
- "area-code": "234",
14
- "pretty": "(234) 555-6789",
15
- "test": "11 digit formatted number"
16
- },
17
- {
18
- "input": "1.379.555.2468",
19
- "number": "3795552468",
20
- "area-code": "379",
21
- "pretty": "(379) 555-2468",
22
- "test": "11 digit number containing separators"
23
- }
24
- ],
25
- "invalid": [
26
- {
27
- "input": "",
28
- "test": "empty input"
29
- },
30
- {
31
- "input": "13579",
32
- "test": "5 digit number"
33
- },
34
- {
35
- "input": "123456789011",
36
- "test": "12 digit number"
37
- },
38
- {
39
- "input": "+2 (468) 555-1379",
40
- "test": "11 digit number not beginning with 1"
41
- },
42
- {
43
- "input": "phone number",
44
- "test": "not a number"
45
- }
46
- ]
47
- }