Skip to content

Commit 0c50aee

Browse files
authored
Sync problem-specs tests (#2860)
* Sync tests * Update `state-of-tic-tac-toe` example * Prettier
1 parent b4166c4 commit 0c50aee

9 files changed

Lines changed: 214 additions & 104 deletions

File tree

exercises/practice/bob/.meta/tests.toml

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,82 +9,85 @@
99
# As user-added comments (using the # character) will be removed when this file
1010
# is regenerated, comments can be added via a `comment` key.
1111

12-
[e162fead-606f-437a-a166-d051915cea8e]
13-
description = "stating something"
12+
[8a2e771d-d6f1-4e3f-b6c6-b41495556e37]
13+
description = "asking a question"
1414

1515
[73a966dc-8017-47d6-bb32-cf07d1a5fcd9]
1616
description = "shouting"
1717

18-
[d6c98afd-df35-4806-b55e-2c457c3ab748]
19-
description = "shouting gibberish"
18+
[a5193c61-4a92-4f68-93e2-f554eb385ec6]
19+
description = "forceful question"
2020

21-
[8a2e771d-d6f1-4e3f-b6c6-b41495556e37]
22-
description = "asking a question"
21+
[bc39f7c6-f543-41be-9a43-fd1c2f753fc0]
22+
description = "silence"
23+
24+
[e162fead-606f-437a-a166-d051915cea8e]
25+
description = "stating something"
2326

2427
[81080c62-4e4d-4066-b30a-48d8d76920d9]
2528
description = "asking a numeric question"
2629

2730
[2a02716d-685b-4e2e-a804-2adaf281c01e]
2831
description = "asking gibberish"
2932

30-
[c02f9179-ab16-4aa7-a8dc-940145c385f7]
31-
description = "talking forcefully"
33+
[bb0011c5-cd52-4a5b-8bfb-a87b6283b0e2]
34+
description = "question with no letters"
3235

33-
[153c0e25-9bb5-4ec5-966e-598463658bcd]
34-
description = "using acronyms in regular speech"
36+
[9bfc677d-ea3a-45f2-be44-35bc8fa3753e]
37+
description = "non-letters with question"
3538

36-
[a5193c61-4a92-4f68-93e2-f554eb385ec6]
37-
description = "forceful question"
39+
[8608c508-f7de-4b17-985b-811878b3cf45]
40+
description = "prattling on"
3841

39-
[a20e0c54-2224-4dde-8b10-bd2cdd4f61bc]
40-
description = "shouting numbers"
42+
[05b304d6-f83b-46e7-81e0-4cd3ca647900]
43+
description = "ending with whitespace"
4144

42-
[f7bc4b92-bdff-421e-a238-ae97f230ccac]
43-
description = "no letters"
45+
[66953780-165b-4e7e-8ce3-4bcb80b6385a]
46+
description = "multiple line question"
47+
include = false
4448

45-
[bb0011c5-cd52-4a5b-8bfb-a87b6283b0e2]
46-
description = "question with no letters"
49+
[2c7278ac-f955-4eb4-bf8f-e33eb4116a15]
50+
description = "multiple line question"
51+
reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a"
52+
53+
[d6c98afd-df35-4806-b55e-2c457c3ab748]
54+
description = "shouting gibberish"
55+
56+
[3c954328-86fb-4c71-8961-e18d6a5e2517]
57+
description = "shouting a statement containing a question mark"
58+
59+
[a20e0c54-2224-4dde-8b10-bd2cdd4f61bc]
60+
description = "shouting numbers"
4761

4862
[496143c8-1c31-4c01-8a08-88427af85c66]
4963
description = "shouting with special characters"
5064

5165
[e6793c1c-43bd-4b8d-bc11-499aea73925f]
5266
description = "shouting with no exclamation mark"
5367

54-
[aa8097cc-c548-4951-8856-14a404dd236a]
55-
description = "statement containing question mark"
56-
57-
[9bfc677d-ea3a-45f2-be44-35bc8fa3753e]
58-
description = "non-letters with question"
59-
60-
[8608c508-f7de-4b17-985b-811878b3cf45]
61-
description = "prattling on"
62-
63-
[bc39f7c6-f543-41be-9a43-fd1c2f753fc0]
64-
description = "silence"
65-
6668
[d6c47565-372b-4b09-b1dd-c40552b8378b]
6769
description = "prolonged silence"
6870

6971
[4428f28d-4100-4d85-a902-e5a78cb0ecd3]
7072
description = "alternate silence"
7173

72-
[66953780-165b-4e7e-8ce3-4bcb80b6385a]
73-
description = "multiple line question"
74-
include = false
74+
[72bd5ad3-9b2f-4931-a988-dce1f5771de2]
75+
description = "other whitespace"
7576

76-
[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
77-
description = "starting with whitespace"
77+
[c02f9179-ab16-4aa7-a8dc-940145c385f7]
78+
description = "talking forcefully"
7879

79-
[05b304d6-f83b-46e7-81e0-4cd3ca647900]
80-
description = "ending with whitespace"
80+
[153c0e25-9bb5-4ec5-966e-598463658bcd]
81+
description = "using acronyms in regular speech"
8182

82-
[72bd5ad3-9b2f-4931-a988-dce1f5771de2]
83-
description = "other whitespace"
83+
[f7bc4b92-bdff-421e-a238-ae97f230ccac]
84+
description = "no letters"
85+
86+
[aa8097cc-c548-4951-8856-14a404dd236a]
87+
description = "statement containing question mark"
88+
89+
[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
90+
description = "starting with whitespace"
8491

8592
[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
8693
description = "non-question ending with whitespace"
87-
88-
[2c7278ac-f955-4eb4-bf8f-e33eb4116a15]
89-
description = "multiple line question"
90-
reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a"

exercises/practice/bob/bob.spec.js

Lines changed: 62 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,29 @@ import { describe, expect, test, xtest } from '@jest/globals';
22
import { hey } from './bob';
33

44
describe('Bob', () => {
5-
test('stating something', () => {
6-
const result = hey('Tom-ay-to, tom-aaaah-to.');
7-
expect(result).toEqual('Whatever.');
5+
test('asking a question', () => {
6+
const result = hey('Does this cryogenic chamber make me look fat?');
7+
expect(result).toEqual('Sure.');
88
});
99

1010
xtest('shouting', () => {
1111
const result = hey('WATCH OUT!');
1212
expect(result).toEqual('Whoa, chill out!');
1313
});
1414

15-
xtest('shouting gibberish', () => {
16-
const result = hey('FCECDFCAAB');
17-
expect(result).toEqual('Whoa, chill out!');
15+
xtest('forceful question', () => {
16+
const result = hey('WHAT THE HELL WERE YOU THINKING?');
17+
expect(result).toEqual("Calm down, I know what I'm doing!");
1818
});
1919

20-
xtest('asking a question', () => {
21-
const result = hey('Does this cryogenic chamber make me look fat?');
22-
expect(result).toEqual('Sure.');
20+
xtest('silence', () => {
21+
const result = hey('');
22+
expect(result).toEqual('Fine. Be that way!');
23+
});
24+
25+
xtest('stating something', () => {
26+
const result = hey('Tom-ay-to, tom-aaaah-to.');
27+
expect(result).toEqual('Whatever.');
2328
});
2429

2530
xtest('asking a numeric question', () => {
@@ -32,64 +37,54 @@ describe('Bob', () => {
3237
expect(result).toEqual('Sure.');
3338
});
3439

35-
xtest('talking forcefully', () => {
36-
const result = hey("Let's go make out behind the gym!");
37-
expect(result).toEqual('Whatever.');
38-
});
39-
40-
xtest('using acronyms in regular speech', () => {
41-
const result = hey("It's OK if you don't want to go to the DMV.");
42-
expect(result).toEqual('Whatever.');
40+
xtest('question with no letters', () => {
41+
const result = hey('4?');
42+
expect(result).toEqual('Sure.');
4343
});
4444

45-
xtest('forceful question', () => {
46-
const result = hey('WHAT THE HELL WERE YOU THINKING?');
47-
expect(result).toEqual("Calm down, I know what I'm doing!");
45+
xtest('non-letters with question', () => {
46+
const result = hey(':) ?');
47+
expect(result).toEqual('Sure.');
4848
});
4949

50-
xtest('shouting numbers', () => {
51-
const result = hey('1, 2, 3 GO!');
52-
expect(result).toEqual('Whoa, chill out!');
50+
xtest('prattling on', () => {
51+
const result = hey('Wait! Hang on. Are you going to be OK?');
52+
expect(result).toEqual('Sure.');
5353
});
5454

55-
xtest('no letters', () => {
56-
const result = hey('1, 2, 3');
57-
expect(result).toEqual('Whatever.');
55+
xtest('ending with whitespace', () => {
56+
const result = hey('Okay if like my spacebar quite a bit? ');
57+
expect(result).toEqual('Sure.');
5858
});
5959

60-
xtest('question with no letters', () => {
61-
const result = hey('4?');
60+
xtest('multiple line question', () => {
61+
const result = hey('\nDoes this cryogenic chamber make\n me look fat?');
6262
expect(result).toEqual('Sure.');
6363
});
6464

65-
xtest('shouting with special characters', () => {
66-
const result = hey('ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!');
65+
xtest('shouting gibberish', () => {
66+
const result = hey('FCECDFCAAB');
6767
expect(result).toEqual('Whoa, chill out!');
6868
});
6969

70-
xtest('shouting with no exclamation mark', () => {
71-
const result = hey('I HATE YOU');
70+
xtest('shouting a statement containing a question mark', () => {
71+
const result = hey('DO LIONS EAT PEOPLE? AHHHHH.');
7272
expect(result).toEqual('Whoa, chill out!');
7373
});
7474

75-
xtest('statement containing question mark', () => {
76-
const result = hey('Ending with a ? means a question.');
77-
expect(result).toEqual('Whatever.');
78-
});
79-
80-
xtest('non-letters with question', () => {
81-
const result = hey(':) ?');
82-
expect(result).toEqual('Sure.');
75+
xtest('shouting numbers', () => {
76+
const result = hey('1, 2, 3 GO!');
77+
expect(result).toEqual('Whoa, chill out!');
8378
});
8479

85-
xtest('prattling on', () => {
86-
const result = hey('Wait! Hang on. Are you going to be OK?');
87-
expect(result).toEqual('Sure.');
80+
xtest('shouting with special characters', () => {
81+
const result = hey('ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!');
82+
expect(result).toEqual('Whoa, chill out!');
8883
});
8984

90-
xtest('silence', () => {
91-
const result = hey('');
92-
expect(result).toEqual('Fine. Be that way!');
85+
xtest('shouting with no exclamation mark', () => {
86+
const result = hey('I HATE YOU');
87+
expect(result).toEqual('Whoa, chill out!');
9388
});
9489

9590
xtest('prolonged silence', () => {
@@ -102,24 +97,34 @@ describe('Bob', () => {
10297
expect(result).toEqual('Fine. Be that way!');
10398
});
10499

105-
xtest('multiple line question', () => {
106-
const result = hey('\nDoes this cryogenic chamber make\n me look fat?');
107-
expect(result).toEqual('Sure.');
100+
xtest('other whitespace', () => {
101+
const result = hey('\n\r \t');
102+
expect(result).toEqual('Fine. Be that way!');
108103
});
109104

110-
xtest('starting with whitespace', () => {
111-
const result = hey(' hmmmmmmm...');
105+
xtest('talking forcefully', () => {
106+
const result = hey("Let's go make out behind the gym!");
112107
expect(result).toEqual('Whatever.');
113108
});
114109

115-
xtest('ending with whitespace', () => {
116-
const result = hey('Okay if like my spacebar quite a bit? ');
117-
expect(result).toEqual('Sure.');
110+
xtest('using acronyms in regular speech', () => {
111+
const result = hey("It's OK if you don't want to go to the DMV.");
112+
expect(result).toEqual('Whatever.');
118113
});
119114

120-
xtest('other whitespace', () => {
121-
const result = hey('\n\r \t');
122-
expect(result).toEqual('Fine. Be that way!');
115+
xtest('no letters', () => {
116+
const result = hey('1, 2, 3');
117+
expect(result).toEqual('Whatever.');
118+
});
119+
120+
xtest('statement containing question mark', () => {
121+
const result = hey('Ending with a ? means a question.');
122+
expect(result).toEqual('Whatever.');
123+
});
124+
125+
xtest('starting with whitespace', () => {
126+
const result = hey(' hmmmmmmm...');
127+
expect(result).toEqual('Whatever.');
123128
});
124129

125130
xtest('non-question ending with whitespace', () => {

exercises/practice/connect/.meta/tests.toml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[6eff0df4-3e92-478d-9b54-d3e8b354db56]
613
description = "an empty board has no winner"
@@ -23,6 +30,12 @@ description = "nobody wins crossing adjacent angles"
2330
[cd61c143-92f6-4a8d-84d9-cb2b359e226b]
2431
description = "X wins crossing from left to right"
2532

33+
[495e33ed-30a9-4012-b46e-d7c4d5fe13c3]
34+
description = "X wins with left-hand dead end fork"
35+
36+
[ab167ab0-4a98-4d0f-a1c0-e1cddddc3d58]
37+
description = "X wins with right-hand dead end fork"
38+
2639
[73d1eda6-16ab-4460-9904-b5f5dd401d0b]
2740
description = "O wins crossing from top to bottom"
2841

exercises/practice/connect/connect.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ describe('Judging a game of connect', () => {
6161
expect(new Board(board).winner()).toEqual('X');
6262
});
6363

64+
xtest('X wins with left-hand dead end fork', () => {
65+
const board = ['. . X .', ' X X . .', ' . X X X', ' O O O O'];
66+
expect(new Board(board).winner()).toEqual('X');
67+
});
68+
69+
xtest('X wins with right-hand dead end fork', () => {
70+
const board = ['. . X X', ' X X . .', ' . X X .', ' O O O O'];
71+
expect(new Board(board).winner()).toEqual('X');
72+
});
73+
6474
xtest('O wins crossing from top to bottom', () => {
6575
const board = [
6676
'. O . .',

exercises/practice/line-up/.meta/tests.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,24 @@ description = "format non-exceptional ordinal numeral 13"
5151
[2bdcebc5-c029-4874-b6cc-e9bec80d603a]
5252
description = "format exceptional ordinal numeral 21"
5353

54+
[a98e2e22-ab41-4557-a7c2-efedc19c16da]
55+
description = "format exceptional ordinal numeral 22 ending in nd even though it is a multiple of 11"
56+
57+
[ab45d2fb-e0ee-4016-b605-76917584db0a]
58+
description = "format exceptional ordinal numeral 33 ending in rd even though it is a multiple of 11"
59+
60+
[c9243603-9f17-45b3-9a41-db9ebdbf08e1]
61+
description = "format exceptional ordinal numeral 52 ending in nd even though it is a multiple of 13"
62+
5463
[74ee2317-0295-49d2-baf0-d56bcefa14e3]
5564
description = "format exceptional ordinal numeral 62"
5665

66+
[3f6c408c-4331-42b6-bb6c-3ad0823e568a]
67+
description = "format non-exceptional ordinal numeral 72 ending in nd even though it is a multiple of 12"
68+
69+
[8db52cd9-9689-413f-a812-6c36fcfd0d07]
70+
description = "format exceptional ordinal numeral 91 ending in st even though it is a multiple of 13"
71+
5772
[b37c332d-7f68-40e3-8503-e43cbd67a0c4]
5873
description = "format exceptional ordinal numeral 100"
5974

@@ -65,3 +80,6 @@ description = "format non-exceptional ordinal numeral 112"
6580

6681
[06b62efe-199e-4ce7-970d-4bf73945713f]
6782
description = "format exceptional ordinal numeral 123"
83+
84+
[6792c54e-59a7-4faf-839a-c4bb61014229]
85+
description = "format large number 972 ending in nd even though it is a multiple of 12"

0 commit comments

Comments
 (0)