Skip to content

Commit fd826ee

Browse files
oob1: Move answers into JavaScript file
Signed-off-by: David A. Wheeler <[email protected]>
1 parent 16f15a4 commit fd826ee

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

docs/labs/oob1.html

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,6 @@
1212

1313
<!-- See create_labs.md for how to create your own lab! -->
1414

15-
<!-- Sample expected answer -->
16-
<script id="expected0" type="plain/text">
17-
if (1 + 2 + 16 > s->s3->rrec.length)
18-
return 0;
19-
</script>
20-
<!--
21-
-->
22-
<script id="expected1" type="plain/text">
23-
if (1 + 2 + payload + 16 > s->s3->rrec.length)
24-
return 0;
25-
</script>
26-
27-
<!-- Full pattern of correct answer -->
28-
<script id="correct0" type="plain/text">
29-
\s*
30-
if \( (NINETEEN > FULL_LENGTH|FULL_LENGTH < NINETEEN) \)
31-
RETURN0
32-
\s*
33-
</script>
34-
<script id="correct1" type="plain/text">
35-
\s*
36-
if \( (PAYLOAD_LENGTH > FULL_LENGTH|FULL_LENGTH < PAYLOAD_LENGTH) \)
37-
RETURN0
38-
\s*
39-
</script>
40-
4115
</head>
4216
<body>
4317
<!-- For GitHub Pages formatting: -->

docs/labs/oob1.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,34 @@ info =
5454
{
5555
term: "RETURN0",
5656
value: String.raw`(RETURN0|\{ RETURN0 \})`
57-
}
58-
]
57+
},
58+
],
59+
expected: [
60+
`if (1 + 2 + 16 > s->s3->rrec.length)
61+
return 0;`,
62+
`if (1 + 2 + payload + 16 > s->s3->rrec.length)
63+
return 0;`
64+
],
65+
correct: [
66+
String.raw` \s*
67+
if \( (NINETEEN > FULL_LENGTH|FULL_LENGTH < NINETEEN) \)
68+
RETURN0 \s*`,
69+
String.raw` \s*
70+
if \( (PAYLOAD_LENGTH > FULL_LENGTH|FULL_LENGTH < PAYLOAD_LENGTH) \)
71+
RETURN0 \s*`,
72+
],
73+
successes: [
74+
[
75+
` if ( s -> s3 -> rrec . length < 19 )
76+
return 0 ;`,
77+
` if ( s -> s3 -> rrec . length < payload + 19 )
78+
return 0;`
79+
],
80+
[
81+
`if(s->s3->rrec.length<19)
82+
return 0 ;`,
83+
`if(s->s3->rrec.length<payload+19)
84+
return 0;`
85+
],
86+
],
5987
}

0 commit comments

Comments
 (0)