Skip to content

Commit 5117441

Browse files
committed
Strengthen TypeScript core exercise contracts
1 parent 8c20da6 commit 5117441

1 file changed

Lines changed: 136 additions & 12 deletions

File tree

scripts/exercise_output_contracts.json

Lines changed: 136 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,74 +1063,198 @@
10631063
},
10641064
{
10651065
"program": "languages/typescript/02-core/algorithms-basics/exercises/01.ts",
1066+
"input_lines": [
1067+
"5",
1068+
"8",
1069+
"3",
1070+
"8",
1071+
"1",
1072+
"8",
1073+
"8"
1074+
],
10661075
"required_stdout_contains": [
1067-
"Count must be a positive integer."
1076+
"First index: 0"
10681077
]
10691078
},
10701079
{
10711080
"program": "languages/typescript/02-core/algorithms-basics/exercises/02.ts",
1081+
"input_lines": [
1082+
"5",
1083+
"8",
1084+
"3",
1085+
"10",
1086+
"1",
1087+
"4"
1088+
],
10721089
"required_stdout_contains": [
1073-
"Count must be a positive integer."
1090+
"Minimum: 1",
1091+
"Maximum: 10",
1092+
"Even count: 3"
10741093
]
10751094
},
10761095
{
10771096
"program": "languages/typescript/02-core/error-handling-and-defensive-programming/exercises/01.ts",
1097+
"input_lines": [
1098+
"Ana Maria 91"
1099+
],
10781100
"required_stdout_contains": [
1079-
"Expected: Full Name Score"
1101+
"Accepted: Ana Maria (91)"
10801102
]
10811103
},
10821104
{
10831105
"program": "languages/typescript/02-core/error-handling-and-defensive-programming/exercises/02.ts",
1106+
"input_lines": [
1107+
"10",
1108+
"skip",
1109+
"20",
1110+
"bad",
1111+
"30"
1112+
],
10841113
"required_stdout_contains": [
1085-
"No valid integers found."
1114+
"Valid count: 3",
1115+
"Average: 20.00"
10861116
]
10871117
},
10881118
{
10891119
"program": "languages/typescript/02-core/file-io-basics/exercises/01.ts",
1120+
"working_dir": "languages/typescript/02-core/file-io-basics",
1121+
"setup_files": [
1122+
{
1123+
"path": "contract-input.txt",
1124+
"lines": [
1125+
"alpha",
1126+
"",
1127+
"beta",
1128+
" ",
1129+
"gamma"
1130+
]
1131+
}
1132+
],
1133+
"input_lines": [
1134+
"contract-input.txt"
1135+
],
10901136
"required_stdout_contains": [
1091-
"Expected a file path."
1137+
"Non-empty lines: 3"
1138+
],
1139+
"cleanup_paths": [
1140+
"contract-input.txt"
10921141
]
10931142
},
10941143
{
10951144
"program": "languages/typescript/02-core/file-io-basics/exercises/02.ts",
1145+
"working_dir": "languages/typescript/02-core/file-io-basics",
1146+
"setup_files": [
1147+
{
1148+
"path": "contract-source.txt",
1149+
"lines": [
1150+
"alpha",
1151+
"Beta"
1152+
]
1153+
}
1154+
],
1155+
"input_lines": [
1156+
"contract-source.txt",
1157+
"contract-destination.txt"
1158+
],
10961159
"required_stdout_contains": [
1097-
"Expected source and destination paths."
1160+
"Wrote uppercase copy to contract-destination.txt"
1161+
],
1162+
"required_outputs": [
1163+
"contract-destination.txt"
1164+
],
1165+
"required_output_contains": [
1166+
{
1167+
"path": "contract-destination.txt",
1168+
"contains": [
1169+
"ALPHA",
1170+
"BETA"
1171+
]
1172+
}
1173+
],
1174+
"cleanup_paths": [
1175+
"contract-source.txt",
1176+
"contract-destination.txt"
10981177
]
10991178
},
11001179
{
11011180
"program": "languages/typescript/02-core/input-validation/exercises/01.ts",
1181+
"input_lines": [
1182+
"12"
1183+
],
11021184
"required_stdout_contains": [
1103-
"Expected one integer."
1185+
"Square: 144"
11041186
]
11051187
},
11061188
{
11071189
"program": "languages/typescript/02-core/input-validation/exercises/02.ts",
1190+
"input_lines": [
1191+
"3",
1192+
"90",
1193+
"80",
1194+
"70"
1195+
],
11081196
"required_stdout_contains": [
1109-
"Score count must be an integer in range 1..50."
1197+
"Average: 80.00"
11101198
]
11111199
},
11121200
{
11131201
"program": "languages/typescript/02-core/maps-and-frequency-counting/exercises/01.ts",
1202+
"input_lines": [
1203+
"red",
1204+
"blue",
1205+
"red",
1206+
"green",
1207+
"blue",
1208+
"red"
1209+
],
11141210
"required_stdout_contains": [
1115-
"Expected at least one word."
1211+
"red: 3",
1212+
"blue: 2",
1213+
"green: 1"
11161214
]
11171215
},
11181216
{
11191217
"program": "languages/typescript/02-core/maps-and-frequency-counting/exercises/02.ts",
1218+
"input_lines": [
1219+
"alpha",
1220+
"beta",
1221+
"alpha",
1222+
"gamma",
1223+
"beta",
1224+
"alpha"
1225+
],
11201226
"required_stdout_contains": [
1121-
"Expected at least one word."
1227+
"Most frequent: alpha",
1228+
"Count: 3"
11221229
]
11231230
},
11241231
{
11251232
"program": "languages/typescript/02-core/sorting-and-searching/exercises/01.ts",
1233+
"input_lines": [
1234+
"5",
1235+
"9",
1236+
"2",
1237+
"7",
1238+
"2",
1239+
"4"
1240+
],
11261241
"required_stdout_contains": [
1127-
"Count must be a positive integer."
1242+
"2 2 4 7 9"
11281243
]
11291244
},
11301245
{
11311246
"program": "languages/typescript/02-core/sorting-and-searching/exercises/02.ts",
1247+
"input_lines": [
1248+
"5",
1249+
"2",
1250+
"4",
1251+
"7",
1252+
"9",
1253+
"11",
1254+
"7"
1255+
],
11321256
"required_stdout_contains": [
1133-
"Count must be a positive integer."
1257+
"Index: 2"
11341258
]
11351259
},
11361260
{

0 commit comments

Comments
 (0)