Skip to content

SRegExp: Answer test results

This page exposes the results of running answer tests on STACK test cases. This page is automatically generated from the STACK unit tests and is designed to show question authors what answer tests actually do. This includes cases where answer tests currentl fail, which gives a negative expected mark. Comments and further test cases are very welcome.

SRegExp

Test
?
Student response
Teacher answer
Opt
Mark
Answer note
SRegExp
1/0
"hello"
-1 ATSRegExp_STACKERROR_SAns.
TEST_FAILED
The answer test failed to execute correctly: please alert your teacher. Division by zero.
SRegExp
"1/0"
1/0
-1 ATSRegExp_STACKERROR_TAns.
TEST_FAILED
The answer test failed to execute correctly: please alert your teacher. Division by zero.
SRegExp
Hello
hello
-1 ATSRegExp_SB_not_string.
The second argument to the SRegExp answer test must be a string. The test failed. Please contact your teacher.
SRegExp
Hello
"hello"
-1 ATSRegExp_SA_not_string.
The first argument to the SRegExp answer test must be a string. The test failed. Please contact your teacher.
SRegExp
"aaaaabbb"
"(aaa)*b"
1 ATSRegExp: ["aaab","aaa"].
SRegExp
"aab"
"(aaa)*b"
1 ATSRegExp: ["b",false].
SRegExp
"aaac"
"(aaa)*b"
0
Anchor pattern to the start and the end of the string
SRegExp
"aab"
"^[aA]*b$"
1 ATSRegExp: ["aab"].
SRegExp
"aab"
"^(aaa)*b$"
0
SRegExp
"aAb"
"^[aA]*b$"
1 ATSRegExp: ["aAb"].
SRegExp
" aAb"
"^[aA]*b$"
0
Case insensitive
SRegExp
"caAb"
"(?i:a*b)"
1 ATSRegExp: ["aAb"].
Options
SRegExp
"Alice went to the market
"
"(Alice|Bob) went to the 
(bank|market)"
1 ATSRegExp: ["Alice went to the market","Alice","market"].
SRegExp
"Malice went to the shop&
quot;
"(Alice|Bob) went to the 
(bank|market)"
0
Whitespace, note test rendering issue, the test string has additional spaces and tabs as does the result
SRegExp
"Alice   went  to      th
e market"
"(Alice|Bob)\\s+went\\s+t
o\\s+the\\s+(bank|market)"
;
1 ATSRegExp: ["Alice went to the market","Alice","market"].
SRegExp
"Alice   went  to      th
emarket"
"(Alice|Bob)\\s+went\\s+t
o\\s+the\\s+(bank|market)"
;
0
Escaping patterns, note the function that does it
SRegExp
"x^2.2"
"x\\^2\\.2"
1 ATSRegExp: ["x^2.2"].
SRegExp
"x^2+sin(x)"
sconcat(string_to_regex("
sin(x)"),"$")
1 ATSRegExp: ["sin(x)"].
SRegExp
"sin(x)+x^2"
sconcat(string_to_regex("
sin(x)"),"$")
0