Spaces:
Running
Running
Upload index.html with huggingface_hub
Browse files- index.html +11 -39
index.html
CHANGED
|
@@ -140,8 +140,7 @@
|
|
| 140 |
|
| 141 |
<script>
|
| 142 |
// ===== Plain "Run" mode starter =====
|
| 143 |
-
const RUN_TEMPLATE = `
|
| 144 |
-
import sys
|
| 145 |
print("Python", sys.version.split()[0])
|
| 146 |
|
| 147 |
def fib(n):
|
|
@@ -151,9 +150,6 @@ def fib(n):
|
|
| 151 |
return a
|
| 152 |
|
| 153 |
print([fib(i) for i in range(10)])
|
| 154 |
-
|
| 155 |
-
# Want plots? Install a package (downloads on first use):
|
| 156 |
-
# import micropip; await micropip.install("matplotlib")
|
| 157 |
`;
|
| 158 |
|
| 159 |
// ===== Problems: each has a hidden .dat (5-bug blackbox + oracle) + a test starter =====
|
|
@@ -162,23 +158,12 @@ const PROBLEMS = {
|
|
| 162 |
data: "q1.dat",
|
| 163 |
public: "allocate",
|
| 164 |
sig: "allocate(students, rooms, capacity, mode)",
|
| 165 |
-
testTemplate: `# Q1
|
| 166 |
-
#
|
| 167 |
-
# A bug is CAUGHT when the program's output differs from the SPEC's expected output.
|
| 168 |
-
#
|
| 169 |
-
# Spec: students 1..300, rooms 1..10, capacity 5..50, mode in {Lecture, Tutorial, Exam}
|
| 170 |
-
# usable_per_room = capacity (Lecture/Tutorial) or capacity // 2 (Exam)
|
| 171 |
-
# total = rooms * usable_per_room
|
| 172 |
-
# SEATED if students <= total else OVERFLOW ; out-of-range/wrong-type -> INVALID
|
| 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"),
|
| 179 |
-
((200, 5, 25, "Lecture"), "OVERFLOW"),
|
| 180 |
-
((50, 2, 30, "Online"), "INVALID"),
|
| 181 |
-
# add your own boundary-value cases...
|
| 182 |
]
|
| 183 |
`,
|
| 184 |
},
|
|
@@ -186,25 +171,12 @@ TESTS = [
|
|
| 186 |
data: "q2.dat",
|
| 187 |
public: "approve",
|
| 188 |
sig: "approve(role, fte, weekly_hours, period)",
|
| 189 |
-
testTemplate: `# Q2
|
| 190 |
-
#
|
| 191 |
-
# A bug is CAUGHT when the program's output differs from the SPEC's expected output.
|
| 192 |
-
#
|
| 193 |
-
# Spec: role in {Tutor, Demonstrator, Marker, Coordinator}, 0 < fte <= 1.0,
|
| 194 |
-
# weekly_hours 1..60, period in {Teaching, Break}
|
| 195 |
-
# base = {Tutor:13, Demonstrator:16, Marker:9, Coordinator:21}; cap = floor(fte*base)
|
| 196 |
-
# Break: hours <= cap -> APPROVED else DENIED
|
| 197 |
-
# Teaching: hours <= cap -> APPROVED; cap < hours <= 2*cap -> REQUIRES_APPROVAL; else DENIED
|
| 198 |
-
# out-of-range / wrong type -> ERROR
|
| 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"),
|
| 205 |
-
(("Marker", 0.5, 3, "Break"), "APPROVED"),
|
| 206 |
-
(("Coordinator", 1.0, 50, "Teaching"), "DENIED"),
|
| 207 |
-
# add your own equivalence-class cases...
|
| 208 |
]
|
| 209 |
`,
|
| 210 |
},
|
|
|
|
| 140 |
|
| 141 |
<script>
|
| 142 |
// ===== Plain "Run" mode starter =====
|
| 143 |
+
const RUN_TEMPLATE = `import sys
|
|
|
|
| 144 |
print("Python", sys.version.split()[0])
|
| 145 |
|
| 146 |
def fib(n):
|
|
|
|
| 150 |
return a
|
| 151 |
|
| 152 |
print([fib(i) for i in range(10)])
|
|
|
|
|
|
|
|
|
|
| 153 |
`;
|
| 154 |
|
| 155 |
// ===== Problems: each has a hidden .dat (5-bug blackbox + oracle) + a test starter =====
|
|
|
|
| 158 |
data: "q1.dat",
|
| 159 |
public: "allocate",
|
| 160 |
sig: "allocate(students, rooms, capacity, mode)",
|
| 161 |
+
testTemplate: `# Q1 Room Allocator -- blackbox.allocate(students, rooms, capacity, mode), 5 bugs.
|
| 162 |
+
# TESTS = [ ((args), "expected-from-spec"), ... ], one case per line.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
TESTS = [
|
| 164 |
+
((50, 2, 30, "Lecture"), "SEATED"),
|
| 165 |
+
((200, 5, 25, "Lecture"), "OVERFLOW"),
|
| 166 |
+
((50, 2, 30, "Online"), "INVALID"),
|
|
|
|
| 167 |
]
|
| 168 |
`,
|
| 169 |
},
|
|
|
|
| 171 |
data: "q2.dat",
|
| 172 |
public: "approve",
|
| 173 |
sig: "approve(role, fte, weekly_hours, period)",
|
| 174 |
+
testTemplate: `# Q2 Workload Approval -- blackbox.approve(role, fte, weekly_hours, period), 5 bugs.
|
| 175 |
+
# TESTS = [ ((args), "expected-from-spec"), ... ], one case per line.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
TESTS = [
|
| 177 |
+
(("Tutor", 1.0, 5, "Teaching"), "APPROVED"),
|
| 178 |
+
(("Marker", 0.5, 3, "Break"), "APPROVED"),
|
| 179 |
+
(("Coordinator", 1.0, 50, "Teaching"), "DENIED"),
|
|
|
|
| 180 |
]
|
| 181 |
`,
|
| 182 |
},
|