trackler 2.2.1.61 → 2.2.1.62

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/forth/canonical-data.json +1 -7
  4. data/problem-specifications/exercises/meetup/description.md +16 -12
  5. data/problem-specifications/exercises/sum-of-multiples/description.md +3 -3
  6. data/tracks/c/config.json +14 -1
  7. data/tracks/c/exercises/anagram/src/anagram.h +19 -4
  8. data/tracks/c/exercises/anagram/src/example.c +27 -40
  9. data/tracks/c/exercises/anagram/test/test_anagram.c +100 -152
  10. data/tracks/c/exercises/sublist/README.md +53 -0
  11. data/tracks/c/exercises/sublist/makefile +15 -0
  12. data/tracks/c/exercises/sublist/src/example.c +63 -0
  13. data/tracks/c/exercises/sublist/src/sublist.h +17 -0
  14. data/tracks/c/exercises/sublist/test/test_sublist.c +243 -0
  15. data/tracks/c/exercises/sublist/test/vendor/unity.c +1300 -0
  16. data/tracks/c/exercises/sublist/test/vendor/unity.h +274 -0
  17. data/tracks/c/exercises/sublist/test/vendor/unity_internals.h +701 -0
  18. data/tracks/ecmascript/config.json +56 -0
  19. data/tracks/ecmascript/exercises/rectangles/README.md +95 -0
  20. data/tracks/ecmascript/exercises/rectangles/example.js +38 -0
  21. data/tracks/ecmascript/exercises/rectangles/package.json +72 -0
  22. data/tracks/ecmascript/exercises/rectangles/rectangles.spec.js +147 -0
  23. data/tracks/ecmascript/exercises/rotational-cipher/README.md +66 -0
  24. data/tracks/ecmascript/exercises/rotational-cipher/example.js +16 -0
  25. data/tracks/ecmascript/exercises/rotational-cipher/package.json +72 -0
  26. data/tracks/ecmascript/exercises/rotational-cipher/rotational-cipher.spec.js +73 -0
  27. data/tracks/ecmascript/exercises/spiral-matrix/README.md +59 -0
  28. data/tracks/ecmascript/exercises/spiral-matrix/example.js +26 -0
  29. data/tracks/ecmascript/exercises/spiral-matrix/package.json +72 -0
  30. data/tracks/ecmascript/exercises/spiral-matrix/spiral-matrix.spec.js +55 -0
  31. data/tracks/ecmascript/exercises/transpose/README.md +94 -0
  32. data/tracks/ecmascript/exercises/transpose/example.js +12 -0
  33. data/tracks/ecmascript/exercises/transpose/package.json +71 -0
  34. data/tracks/ecmascript/exercises/transpose/transpose.spec.js +121 -0
  35. data/tracks/go/exercises/allergies/.meta/gen.go +88 -0
  36. data/tracks/go/exercises/allergies/allergies_test.go +19 -46
  37. data/tracks/go/exercises/allergies/cases_test.go +60 -0
  38. data/tracks/go/exercises/bob/bob.go +0 -2
  39. data/tracks/go/exercises/forth/cases_test.go +2 -7
  40. data/tracks/go/exercises/nucleotide-count/nucleotide_count.go +0 -2
  41. data/tracks/go/exercises/pangram/.meta/gen.go +54 -0
  42. data/tracks/go/exercises/pangram/cases_test.go +62 -0
  43. data/tracks/go/exercises/pangram/example.go +3 -5
  44. data/tracks/go/exercises/pangram/pangram_test.go +3 -24
  45. data/tracks/go/exercises/rna-transcription/rna_transcription.go +0 -2
  46. data/tracks/go/exercises/robot-name/bonus_example.go +0 -2
  47. data/tracks/java/exercises/acronym/.meta/src/reference/java/Acronym.java +3 -3
  48. data/tracks/lfe/config.json +4 -3
  49. data/tracks/perl6/docs/SNIPPET.txt +8 -3
  50. data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -1
  51. data/tracks/perl6/exercises/allergies/Example.pm6 +1 -1
  52. data/tracks/perl6/exercises/allergies/allergies.t +10 -2
  53. data/tracks/perl6/exercises/allergies/example.yaml +10 -2
  54. data/tracks/perl6/exercises/leap/Example.pm6 +1 -1
  55. data/tracks/perl6/exercises/leap/Leap.pm6 +1 -1
  56. data/tracks/perl6/exercises/leap/example.yaml +10 -2
  57. data/tracks/perl6/exercises/leap/leap.t +10 -2
  58. data/tracks/perl6/exercises/luhn/Example.pm6 +1 -1
  59. data/tracks/perl6/exercises/luhn/Luhn.pm6 +1 -1
  60. data/tracks/perl6/exercises/luhn/example.yaml +10 -2
  61. data/tracks/perl6/exercises/luhn/luhn.t +10 -2
  62. data/tracks/perl6/exercises/pangram/Example.pm6 +1 -1
  63. data/tracks/perl6/exercises/pangram/Pangram.pm6 +1 -1
  64. data/tracks/perl6/exercises/pangram/example.yaml +12 -6
  65. data/tracks/perl6/exercises/pangram/pangram.t +9 -3
  66. data/tracks/python/config.json +38 -0
  67. data/tracks/python/exercises/complex-numbers/complex_numbers_test.py +81 -66
  68. data/tracks/python/exercises/connect/README.md +44 -0
  69. data/tracks/python/exercises/connect/connect.py +7 -0
  70. data/tracks/python/exercises/connect/connect_test.py +118 -0
  71. data/tracks/python/exercises/connect/example.py +61 -0
  72. data/tracks/python/exercises/go-counting/README.md +44 -0
  73. data/tracks/python/exercises/go-counting/example.py +62 -0
  74. data/tracks/python/exercises/go-counting/go_counting.py +38 -0
  75. data/tracks/python/exercises/go-counting/go_counting_test.py +92 -0
  76. data/tracks/python/exercises/parallel-letter-frequency/README.md +24 -0
  77. data/tracks/python/exercises/parallel-letter-frequency/example.py +56 -0
  78. data/tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency.py +2 -0
  79. data/tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency_test.py +61 -0
  80. data/tracks/python/exercises/strain/README.md +3 -1
  81. data/tracks/python/exercises/strain/strain.py +2 -2
  82. data/tracks/rust/.travis.yml +1 -0
  83. data/tracks/rust/README.md +2 -0
  84. data/tracks/rust/_test/check-exercises.sh +41 -54
  85. data/tracks/rust/_test/ensure-readmes-are-updated.sh +40 -0
  86. data/tracks/rust/bin/test-exercise +84 -0
  87. data/tracks/rust/exercises/alphametics/.meta/test-in-release-mode +2 -0
  88. data/tracks/rust/exercises/alphametics/src/lib.rs +1 -1
  89. data/tracks/rust/exercises/dominoes/README.md +3 -3
  90. data/tracks/rust/exercises/isbn-verifier/README.md +3 -2
  91. data/tracks/rust/exercises/nucleotide-count/README.md +2 -2
  92. data/tracks/rust/exercises/perfect-numbers/src/lib.rs +10 -0
  93. data/tracks/rust/exercises/phone-number/README.md +1 -1
  94. data/tracks/rust/exercises/pythagorean-triplet/src/lib.rs +3 -0
  95. data/tracks/rust/exercises/rectangles/README.md +9 -9
  96. data/tracks/rust/exercises/two-bucket/README.md +7 -7
  97. data/tracks/typescript/config.json +16 -0
  98. data/tracks/typescript/exercises/diamond/README.md +84 -0
  99. data/tracks/typescript/exercises/diamond/diamond.example.ts +51 -0
  100. data/tracks/typescript/exercises/diamond/diamond.test.ts +35 -0
  101. data/tracks/typescript/exercises/diamond/diamond.ts +0 -0
  102. data/tracks/typescript/exercises/diamond/package.json +36 -0
  103. data/tracks/typescript/exercises/diamond/tsconfig.json +22 -0
  104. data/tracks/typescript/exercises/diamond/tslint.json +127 -0
  105. data/tracks/typescript/exercises/diamond/yarn.lock +2624 -0
  106. metadata +53 -2
@@ -0,0 +1,12 @@
1
+ function trimTrailingUndefined(array) {
2
+ const trailingUndefinedCount = [...array].reverse().findIndex(x => x !== undefined);
3
+ return array.slice(0, array.length - trailingUndefinedCount);
4
+ }
5
+
6
+ export default function transpose(input) {
7
+ const maxCol = Math.max(0, ...(input.map(row => row.length)));
8
+ return [...Array(maxCol).keys()].map(col =>
9
+ trimTrailingUndefined(input.map((_v, row) => input[row][col]))
10
+ .map(charOrUndefined => charOrUndefined || ' ')
11
+ .join(''));
12
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "xecmascript",
3
+ "version": "0.0.0",
4
+ "description": "Exercism exercises in ECMAScript 6.",
5
+ "author": "Katrina Owen",
6
+ "private": true,
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/exercism/xecmascript"
10
+ },
11
+ "devDependencies": {
12
+ "babel-jest": "^20.0.3",
13
+ "babel-plugin-transform-builtin-extend": "^1.1.2",
14
+ "babel-preset-env": "^1.4.0",
15
+ "eslint": "^3.19.0",
16
+ "eslint-config-airbnb": "^15.0.1",
17
+ "eslint-plugin-import": "^2.2.0",
18
+ "eslint-plugin-jsx-a11y": "^5.0.1",
19
+ "eslint-plugin-react": "^7.0.1",
20
+ "jest": "^20.0.4"
21
+ },
22
+ "jest": {
23
+ "modulePathIgnorePatterns": [
24
+ "package.json"
25
+ ]
26
+ },
27
+ "babel": {
28
+ "presets": [
29
+ "env"
30
+ ],
31
+ "plugins": [
32
+ [
33
+ "babel-plugin-transform-builtin-extend",
34
+ {
35
+ "globals": [
36
+ "Error"
37
+ ]
38
+ }
39
+ ],
40
+ [
41
+ "transform-regenerator"
42
+ ]
43
+ ]
44
+ },
45
+ "scripts": {
46
+ "test": "jest --no-cache ./*",
47
+ "watch": "jest --no-cache --watch ./*",
48
+ "lint": "eslint .",
49
+ "lint-test": "eslint . && jest --no-cache ./* "
50
+ },
51
+ "eslintConfig": {
52
+ "parserOptions": {
53
+ "ecmaVersion": 6,
54
+ "sourceType": "module"
55
+ },
56
+ "env": {
57
+ "es6": true,
58
+ "node": true,
59
+ "jest": true
60
+ },
61
+ "extends": "airbnb",
62
+ "rules": {
63
+ "import/no-unresolved": "off",
64
+ "import/extensions": "off"
65
+ }
66
+ },
67
+ "licenses": [
68
+ "MIT"
69
+ ],
70
+ "dependencies": {}
71
+ }
@@ -0,0 +1,121 @@
1
+ import transpose from './transpose';
2
+
3
+ describe('Transpose', () => {
4
+ test('empty string', () => {
5
+ expect(transpose([])).toEqual([]);
6
+ });
7
+
8
+ xtest('two characters in a row', () => {
9
+ const input = ['A1'];
10
+ const expected = ['A', '1'];
11
+ expect(transpose(input)).toEqual(expected);
12
+ });
13
+
14
+ xtest('two characters in a column', () => {
15
+ const input = ['A', '1'];
16
+ const expected = ['A1'];
17
+ expect(transpose(input)).toEqual(expected);
18
+ });
19
+
20
+ xtest('simple', () => {
21
+ const input = ['ABC', '123'];
22
+ const expected = ['A1', 'B2', 'C3'];
23
+ expect(transpose(input)).toEqual(expected);
24
+ });
25
+
26
+ xtest('single line', () => {
27
+ const input = ['Single line.'];
28
+ const expected = ['S', 'i', 'n', 'g', 'l', 'e', ' ', 'l', 'i', 'n', 'e', '.'];
29
+ expect(transpose(input)).toEqual(expected);
30
+ });
31
+
32
+ xtest('first line longer than second line', () => {
33
+ const input = ['The fourth line.', 'The fifth line.'];
34
+ const expected = ['TT', 'hh', 'ee', ' ', 'ff', 'oi', 'uf', 'rt', 'th', 'h ', ' l', 'li', 'in', 'ne', 'e.', '.'];
35
+ expect(transpose(input)).toEqual(expected);
36
+ });
37
+
38
+ xtest('second line longer than first line', () => {
39
+ const input = ['The first line.', 'The second line.'];
40
+ const expected = ['TT', 'hh', 'ee', ' ', 'fs', 'ie', 'rc', 'so', 'tn', ' d', 'l ', 'il', 'ni', 'en', '.e', ' .'];
41
+ expect(transpose(input)).toEqual(expected);
42
+ });
43
+
44
+ xtest('square', () => {
45
+ const input = ['HEART', 'EMBER', 'ABUSE', 'RESIN', 'TREND'];
46
+ const expected = ['HEART', 'EMBER', 'ABUSE', 'RESIN', 'TREND'];
47
+ expect(transpose(input)).toEqual(expected);
48
+ });
49
+
50
+ xtest('rectangle', () => {
51
+ const input = ['FRACTURE', 'OUTLINED', 'BLOOMING', 'SEPTETTE'];
52
+ const expected = ['FOBS', 'RULE', 'ATOP', 'CLOT', 'TIME', 'UNIT', 'RENT', 'EDGE'];
53
+ expect(transpose(input)).toEqual(expected);
54
+ });
55
+
56
+ xtest('triangle', () => {
57
+ const input = ['T', 'EE', 'AAA', 'SSSS', 'EEEEE', 'RRRRRR'];
58
+ const expected = ['TEASER', ' EASER', ' ASER', ' SER', ' ER', ' R'];
59
+ expect(transpose(input)).toEqual(expected);
60
+ });
61
+
62
+ xtest('many lines', () => {
63
+ const input = ['Chor. Two households, both alike in dignity,', 'In fair Verona, where we lay our scene,', 'From ancient grudge break to new mutiny,', 'Where civil blood makes civil hands unclean.', 'From forth the fatal loins of these two foes', 'A pair of star-cross\'d lovers take their life;', 'Whose misadventur\'d piteous overthrows', 'Doth with their death bury their parents\' strife.', 'The fearful passage of their death-mark\'d love,', 'And the continuance of their parents\' rage,', 'Which, but their children\'s end, naught could remove,', 'Is now the two hours\' traffic of our stage;', 'The which if you with patient ears attend,', 'What here shall miss, our toil shall strive to mend.'];
64
+ const expected = [
65
+ 'CIFWFAWDTAWITW',
66
+ 'hnrhr hohnhshh',
67
+ 'o oeopotedi ea',
68
+ 'rfmrmash cn t',
69
+ '.a e ie fthow ',
70
+ ' ia fr weh,whh',
71
+ 'Trnco miae ie',
72
+ 'w ciroitr btcr',
73
+ 'oVivtfshfcuhhe',
74
+ ' eeih a uote ',
75
+ 'hrnl sdtln is',
76
+ 'oot ttvh tttfh',
77
+ 'un bhaeepihw a',
78
+ 'saglernianeoyl',
79
+ 'e,ro -trsui ol',
80
+ 'h uofcu sarhu ',
81
+ 'owddarrdan o m',
82
+ 'lhg to\'egccuwi',
83
+ 'deemasdaeehris',
84
+ 'sr als t ists',
85
+ ',ebk \'phool\'h,',
86
+ ' reldi ffd ',
87
+ 'bweso tb rtpo',
88
+ 'oea ileutterau',
89
+ 't kcnoorhhnatr',
90
+ 'hl isvuyee\'fi ',
91
+ ' atv es iisfet',
92
+ 'ayoior trr ino',
93
+ 'l lfsoh ecti',
94
+ 'ion vedpn l',
95
+ 'kuehtteieadoe ',
96
+ 'erwaharrar,fas',
97
+ ' nekt te rh',
98
+ 'ismdsehphnnosa',
99
+ 'ncuse ra-tau l',
100
+ ' et tormsural',
101
+ 'dniuthwea\'g t ',
102
+ 'iennwesnr hsts',
103
+ 'g,ycoi tkrttet',
104
+ 'n ,l r s\'a anr',
105
+ 'i ef \'dgcgdi',
106
+ 't aol eoe,v',
107
+ 'y nei sl,u; e',
108
+ ', .sf to l ',
109
+ ' e rv d t',
110
+ ' ; ie o',
111
+ ' f, r ',
112
+ ' e e m',
113
+ ' . m e',
114
+ ' o n',
115
+ ' v d',
116
+ ' e .',
117
+ ' ,',
118
+ ];
119
+ expect(transpose(input)).toEqual(expected);
120
+ });
121
+ });
@@ -0,0 +1,88 @@
1
+ package main
2
+
3
+ import (
4
+ "encoding/json"
5
+ "log"
6
+ "text/template"
7
+
8
+ "../../../gen"
9
+ )
10
+
11
+ func main() {
12
+ t, err := template.New("").Parse(tmpl)
13
+ if err != nil {
14
+ log.Fatal(err)
15
+ }
16
+ var j js
17
+ if err := gen.Gen("allergies", &j, t); err != nil {
18
+ log.Fatal(err)
19
+ }
20
+ }
21
+
22
+ // The JSON structure we expect to be able to unmarshal into
23
+ type js struct {
24
+ Exercise string
25
+ Version string
26
+ Groups []testGroup `json:"Cases"`
27
+ }
28
+
29
+ type testGroup struct {
30
+ Description string
31
+ Cases []json.RawMessage `property:"RAW"`
32
+ AllergicToCases []struct {
33
+ Description string
34
+ Score uint
35
+ Expected []struct {
36
+ Substance string
37
+ Result bool
38
+ }
39
+ } `property:"allergicTo"`
40
+ ListCases []struct {
41
+ Description string
42
+ Score uint
43
+ Expected []string
44
+ } `property:"list"`
45
+ }
46
+
47
+ var tmpl = `package allergies
48
+
49
+ {{.Header}}
50
+
51
+ {{range .J.Groups}}
52
+ // {{ .Description }}
53
+
54
+ {{- if .AllergicToCases }}
55
+ type allergicResult struct{
56
+ substance string
57
+ result bool
58
+ }
59
+ var allergicToTests = []struct {
60
+ description string
61
+ score uint
62
+ expected []allergicResult
63
+ }{
64
+ {{- range .AllergicToCases }}
65
+ {
66
+ description: {{.Description | printf "%q"}},
67
+ score: {{.Score}},
68
+ expected: []allergicResult{ {{range .Expected}}
69
+ { {{.Substance | printf "%q"}}, {{.Result}} },{{end}}
70
+ },
71
+ },
72
+ {{- end }}
73
+ }
74
+ {{- end }}
75
+
76
+ {{- if .ListCases }}
77
+ var listTests = []struct {
78
+ description string
79
+ score uint
80
+ expected []string
81
+ }{
82
+ {{- range .ListCases }}
83
+ { {{.Description | printf "%q"}}, {{.Score}}, {{.Expected | printf "%#v"}}},
84
+ {{- end }}
85
+ }
86
+ {{- end }}
87
+ {{end}}
88
+ `
@@ -1,35 +1,16 @@
1
1
  package allergies
2
2
 
3
3
  import (
4
- "fmt"
5
- "sort"
4
+ "reflect"
6
5
  "testing"
7
6
  )
8
7
 
9
- var allergiesTests = []struct {
10
- expected []string
11
- input uint
12
- }{
13
- {[]string{}, 0},
14
- {[]string{"eggs"}, 1},
15
- {[]string{"peanuts"}, 2},
16
- {[]string{"strawberries"}, 8},
17
- {[]string{"eggs", "peanuts"}, 3},
18
- {[]string{"eggs", "shellfish"}, 5},
19
- {[]string{"strawberries", "tomatoes", "chocolate", "pollen", "cats"}, 248},
20
- {[]string{"eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"}, 255},
21
- {[]string{"eggs", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"}, 509},
22
- }
23
-
24
8
  func TestAllergies(t *testing.T) {
25
- for _, test := range allergiesTests {
26
- actual := Allergies(test.input)
27
- sort.Strings(actual)
28
- sort.Strings(test.expected)
29
- if fmt.Sprintf("%s", actual) != fmt.Sprintf("%s", test.expected) {
30
- t.Fatalf("FAIL: Allergies(%d): expected %q, actual %q", test.input, test.expected, actual)
9
+ for _, test := range listTests {
10
+ if actual := Allergies(test.score); !reflect.DeepEqual(actual, test.expected) && (len(actual) > 0 || len(test.expected) > 0) {
11
+ t.Fatalf("FAIL: Allergies(%d): expected %#v, actual %#v", test.score, test.expected, actual)
31
12
  } else {
32
- t.Logf("PASS: Allergic to %q", test.expected)
13
+ t.Logf("PASS: Allergic to %#v", test.expected)
33
14
  }
34
15
  }
35
16
  }
@@ -40,31 +21,21 @@ func BenchmarkAllergies(b *testing.B) {
40
21
  b.StartTimer()
41
22
 
42
23
  for i := 0; i < b.N; i++ {
43
- Allergies(test.i)
24
+ Allergies(test.score)
44
25
  }
45
26
  b.StopTimer()
46
27
  }
47
28
  }
48
29
 
49
- var allergicToTests = []struct {
50
- expected bool
51
- i uint
52
- allergen string
53
- }{
54
- {false, 0, "peanuts"},
55
- {false, 0, "cats"},
56
- {false, 0, "strawberries"},
57
- {true, 1, "eggs"},
58
- {true, 5, "eggs"},
59
- }
60
-
61
30
  func TestAllergicTo(t *testing.T) {
62
31
  for _, test := range allergicToTests {
63
- actual := AllergicTo(test.i, test.allergen)
64
- if actual != test.expected {
65
- t.Fatalf("FAIL: AllergicTo(%d, %s): expected %t, actual %t", test.i, test.allergen, test.expected, actual)
66
- } else {
67
- t.Logf("PASS: AllergicTo(%d, %s) %t", test.i, test.allergen, actual)
32
+ for _, response := range test.expected {
33
+ actual := AllergicTo(test.score, response.substance)
34
+ if actual != response.result {
35
+ t.Fatalf("FAIL: AllergicTo(%d, %s): expected %t, actual %t", test.score, response.substance, response.result, actual)
36
+ } else {
37
+ t.Logf("PASS: AllergicTo(%d, %s) %t", test.score, response.substance, actual)
38
+ }
68
39
  }
69
40
  }
70
41
  }
@@ -72,11 +43,13 @@ func TestAllergicTo(t *testing.T) {
72
43
  func BenchmarkAllergicTo(b *testing.B) {
73
44
  b.StopTimer()
74
45
  for _, test := range allergicToTests {
75
- b.StartTimer()
46
+ for _, response := range test.expected {
47
+ b.StartTimer()
76
48
 
77
- for i := 0; i < b.N; i++ {
78
- AllergicTo(test.i, test.allergen)
49
+ for i := 0; i < b.N; i++ {
50
+ AllergicTo(test.score, response.substance)
51
+ }
52
+ b.StopTimer()
79
53
  }
80
- b.StopTimer()
81
54
  }
82
55
  }
@@ -0,0 +1,60 @@
1
+ package allergies
2
+
3
+ // Source: exercism/problem-specifications
4
+ // Commit: 879bc89 allergies: Fix canonical-data.json formatting
5
+ // Problem Specifications Version: 1.0.0
6
+
7
+ // allergicTo
8
+ type allergicResult struct {
9
+ substance string
10
+ result bool
11
+ }
12
+
13
+ var allergicToTests = []struct {
14
+ description string
15
+ score uint
16
+ expected []allergicResult
17
+ }{
18
+ {
19
+ description: "no allergies means not allergic",
20
+ score: 0,
21
+ expected: []allergicResult{
22
+ {"peanuts", false},
23
+ {"cats", false},
24
+ {"strawberries", false},
25
+ },
26
+ },
27
+ {
28
+ description: "is allergic to eggs",
29
+ score: 1,
30
+ expected: []allergicResult{
31
+ {"eggs", true},
32
+ },
33
+ },
34
+ {
35
+ description: "allergic to eggs in addition to other stuff",
36
+ score: 5,
37
+ expected: []allergicResult{
38
+ {"eggs", true},
39
+ {"shellfish", true},
40
+ {"strawberries", false},
41
+ },
42
+ },
43
+ }
44
+
45
+ // list
46
+ var listTests = []struct {
47
+ description string
48
+ score uint
49
+ expected []string
50
+ }{
51
+ {"no allergies at all", 0, []string{}},
52
+ {"allergic to just eggs", 1, []string{"eggs"}},
53
+ {"allergic to just peanuts", 2, []string{"peanuts"}},
54
+ {"allergic to just strawberries", 8, []string{"strawberries"}},
55
+ {"allergic to eggs and peanuts", 3, []string{"eggs", "peanuts"}},
56
+ {"allergic to more than eggs but not peanuts", 5, []string{"eggs", "shellfish"}},
57
+ {"allergic to lots of stuff", 248, []string{"strawberries", "tomatoes", "chocolate", "pollen", "cats"}},
58
+ {"allergic to everything", 255, []string{"eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"}},
59
+ {"ignore non allergen score parts", 509, []string{"eggs", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"}},
60
+ }