How do I check for regexp over multiple lines?

How do I check for regexp over multiple lines?

Visvanath Ratnaweera發表於
Number of replies: 5
Particularly helpful Moodlers的相片 Translators的相片

Let's say, I expect a program to print two lines with anything in them:

anything
anything

What should be in my vpl_evaluate.cases? This doesn't work:

output = /.*/i
/.*/i

First time user. My reference was https://vpl.dis.ulpgc.es/index.php?view=article&id=65:general-documentation&catid=20 > Creating automated tests.


評比平均分數: -
In reply to Visvanath Ratnaweera

Re: How do I check for regexp over multiple lines?

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
No echo coming and not finding any other VPL specific documents on regular expressions I started to reverse engineer the VPL text patterns but ran aground right at the start.

My test case:
case =
input =
output = 'mm'
Works as expected: Only the following program line (in Pascal),
writeln('mm');
returns "1 test run/ 1 test passed" everything else, 'm', 'mn', ' ', and so on return "Incorrect program output".

Now comes the odd part. Here is the new  test case:
case =
input =
output = '--'

Now not  only

writeln('--');

returns success, but many, many other strings. '-', '---', 'm', 'mn', 'mnn' and many more.

What haven't I understood? Could very well be a rookie mistake.


In reply to Visvanath Ratnaweera

Re: How do I check for regexp over multiple lines?

Garth Brady發表於
Particularly helpful Moodlers的相片
I'm still learning VPL myself, but do " vs ' make a difference in the output? i.e. output = '5' vs output = "5"? See docs: https://vpl.dis.ulpgc.es/documentation/vpl-3.4.3+/biotes.html#output
In reply to Garth Brady

Re: How do I check for regexp over multiple lines?

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
Voila!
case =
input =
output = "--"
(double quotes) behave "normal". Many thanks!

I wonder though what '--' means to VPL.

My original problem is still pending. I will check the docs you've provided.
In reply to Visvanath Ratnaweera

Re: How do I check for regexp over multiple lines?

Garth Brady發表於
Particularly helpful Moodlers的相片
re #1: I'm afraid I don't know how to test for anything given that I'm always testing for something!

re #2: I believe '--' qualifies as nonstrict text (see here https://vpl.dis.ulpgc.es/documentation/vpl-3.4.3+/biotes.html#checking-text). The docs are quite thorough and contain lots of options. I tend to make custom cases where I generate random input for my test cases and then require exact text on the student output (https://vpl.dis.ulpgc.es/documentation/vpl-3.4.3+/biotes.html#checking-exact-text). This may prove useful to you if you're interested in the approach I'm taking here: (https://github.com/itsguysmiley/vpl-samples).
評比平均分數:Useful (1)