grammarware / software-evolution

Software Evolution
MIT License
1 stars 0 forks source link

2 cases where test cases diverge from documentation #24

Open eefscheef opened 4 months ago

eefscheef commented 4 months ago

1) The provided test files contain quite a lot of 'numeric' boolean expressions. The BabyCobol Language Reference doesn't specify anything about boolean expressions, and the paper only mentions TRUE and FALSE as valid boolean literals. Examples: recombined_formatted/test_214204.baby LOOP WHILE 2 recombined_formatted/test_262888.baby LOOP WHILE -12.121 Should we add parsing support for this, or is this a mistake in test generation?

2) The provided test files (and the paper) use WHEN for subsequent WhenBlocks in EVALUATE statements. According to the diagram in the language reference, these should use the ALSO keyword. Example: recombined_formatted/test_66672.baby

EVALUATE CURRENT-YEAR - BIRTH-YEAR
           WHEN 1 THROUGH 17
           DISPLAY "NOT LEGAL AGE"
           WHEN 18 THROUGH 99
           DISPLAY "LEGAL AGE"
           WHEN OTHER
           DISPLAY "WRONG AGE"
           END.
grammarware commented 4 months ago

One the first item — you're definitely right. Technically these are incorrect test programs! If you want to support them, go the C way and treat all non-zeroes as TRUE and all zeroes as FALSE, but then if you want to do it well, it should correspond to the given PICTURE clause (technically the MOVE SPACES thing), and the solution quickly becomes overengineered. Just refuse to support anything non-Boolean instead is what my advice would be.

For the second point: ALSO is not a mandatory part, but an optional one when using EVALUATE for several expressions at the same time. For instance, you could have done EVALUATE CURRENT-YEAR - BIRTH-YEAR ALSO CURRENT-MONTH - BIRTH-MONTH and then do some creative WHEN 1 THROUGH 17 ALSO 1 THROUGH 11