sh1k4ku commited on
Commit
42532b5
·
verified ·
1 Parent(s): 69232ed

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +14 -8
index.html CHANGED
@@ -173,10 +173,11 @@ const PROBLEMS = {
173
  #
174
  # Write a list named TESTS, one case per line, in the order:
175
  # ((students, rooms, capacity, mode), "expected-from-spec")
 
176
  TESTS = [
177
- ((1, 1, 5, "Lecture"), "SEATED"),
178
- ((301, 5, 25, "Lecture"), "INVALID"),
179
- ((0, 1, 5, "Lecture"), "INVALID"),
180
  # add your own boundary-value cases...
181
  ]
182
  `,
@@ -198,9 +199,11 @@ TESTS = [
198
  #
199
  # Write a list named TESTS, one case per line, in the order:
200
  # ((role, fte, weekly_hours, period), "expected-from-spec")
 
201
  TESTS = [
202
- (("Tutor", 1.0, 5, "Teaching"), "APPROVED"),
203
- (("Lecturer", 0.5, 10, "Teaching"), "ERROR"),
 
204
  # add your own equivalence-class cases...
205
  ]
206
  `,
@@ -330,6 +333,7 @@ def __bb_run(source):
330
  if not isinstance(TESTS, (list, tuple)):
331
  return json.dumps({"ok": False, "error": "Define a list named TESTS = [ ((args), expected), ... ] -- one case per line."})
332
  fn = info["fn"]; ref = info["ref"]; BUGS = info["bugs"]; REASONS = info["reasons"]
 
333
  caught = {}
334
  rows = []
335
  for i, case in enumerate(TESTS):
@@ -362,11 +366,13 @@ def __bb_run(source):
362
  else:
363
  if bug is None:
364
  bug = "(unknown)"
 
365
  first = bug not in caught
366
  if first:
367
  caught[bug] = line
368
  rows.append({"line": line, "status": "bug" if first else "dup",
369
- "bug": bug, "reason": REASONS.get(bug, "output differs from the spec"),
 
370
  "argstr": argstr, "actual": __s(actual), "expected": __s(expected)})
371
  else:
372
  if not valid_expected:
@@ -469,10 +475,10 @@ function renderReport(rep) {
469
  for (const r of rep.rows) {
470
  const at = r.line ? "line " + r.line : "(unknown line)";
471
  if (r.status === "bug") {
472
- append(`✓ Bug caught at ${at}: ${r.reason}\n`, "ok");
473
  append(` input ${r.argstr} → program returned ${r.actual}, spec expects ${r.expected}\n`, "meta");
474
  } else if (r.status === "dup") {
475
- append(`· ${at}: catches the same bug again (${r.bug})\n`, "meta");
476
  } else if (r.status === "invalid") {
477
  append(`⚠ ${at}: expected ${r.expected} does NOT match the spec (spec says ${r.spec}) — this test does not count\n`, "warn");
478
  } else if (r.status === "ok") {
 
173
  #
174
  # Write a list named TESTS, one case per line, in the order:
175
  # ((students, rooms, capacity, mode), "expected-from-spec")
176
+ # (These starter cases are all valid and catch no bug -- replace with your own.)
177
  TESTS = [
178
+ ((50, 2, 30, "Lecture"), "SEATED"), # 50 <= 2*30 = 60
179
+ ((200, 5, 25, "Lecture"), "OVERFLOW"), # 200 > 5*25 = 125
180
+ ((50, 2, 30, "Online"), "INVALID"), # "Online" is not a valid mode
181
  # add your own boundary-value cases...
182
  ]
183
  `,
 
199
  #
200
  # Write a list named TESTS, one case per line, in the order:
201
  # ((role, fte, weekly_hours, period), "expected-from-spec")
202
+ # (These starter cases are all valid and catch no bug -- replace with your own.)
203
  TESTS = [
204
+ (("Tutor", 1.0, 5, "Teaching"), "APPROVED"), # 5 <= cap = 13
205
+ (("Marker", 0.5, 3, "Break"), "APPROVED"), # Break, 3 <= cap = 4
206
+ (("Coordinator", 1.0, 50, "Teaching"), "DENIED"), # 50 > 2*cap = 42
207
  # add your own equivalence-class cases...
208
  ]
209
  `,
 
333
  if not isinstance(TESTS, (list, tuple)):
334
  return json.dumps({"ok": False, "error": "Define a list named TESTS = [ ((args), expected), ... ] -- one case per line."})
335
  fn = info["fn"]; ref = info["ref"]; BUGS = info["bugs"]; REASONS = info["reasons"]
336
+ order = list(BUGS) # fixed bug numbering: order.index(name)+1
337
  caught = {}
338
  rows = []
339
  for i, case in enumerate(TESTS):
 
366
  else:
367
  if bug is None:
368
  bug = "(unknown)"
369
+ num = order.index(bug) + 1 if bug in order else "?"
370
  first = bug not in caught
371
  if first:
372
  caught[bug] = line
373
  rows.append({"line": line, "status": "bug" if first else "dup",
374
+ "bug": bug, "num": num, "total": len(BUGS),
375
+ "reason": REASONS.get(bug, "output differs from the spec"),
376
  "argstr": argstr, "actual": __s(actual), "expected": __s(expected)})
377
  else:
378
  if not valid_expected:
 
475
  for (const r of rep.rows) {
476
  const at = r.line ? "line " + r.line : "(unknown line)";
477
  if (r.status === "bug") {
478
+ append(`✓ Bug #${r.num}/${r.total} caught at ${at}: ${r.reason}\n`, "ok");
479
  append(` input ${r.argstr} → program returned ${r.actual}, spec expects ${r.expected}\n`, "meta");
480
  } else if (r.status === "dup") {
481
+ append(`· ${at}: catches bug #${r.num} again\n`, "meta");
482
  } else if (r.status === "invalid") {
483
  append(`⚠ ${at}: expected ${r.expected} does NOT match the spec (spec says ${r.spec}) — this test does not count\n`, "warn");
484
  } else if (r.status === "ok") {