jGleitz / JUnit-KIT

Tests for the Tasks of the Programming Lecture for first semesters at the Karlsruhe Institute for Technology, winter semester 14/15. Among the tests themselves, this repository contains helpfull classes for testing unknown implementations.
GNU General Public License v2.0
7 stars 7 forks source link

Is a + in speedup or rule really an error? #164

Closed jGleitz closed 9 years ago

jGleitz commented 9 years ago

I'm not sure whether we're really allowed to expexct an error message for an "+" in the speedup and rule command line argument. Here's why:

The task sheet defines the following for the speedup argument:

value ist ein Platzhalter für eine positive Integerzahl ab 1

It depends heavily on what you define as an Integer. But you could argue that they most likely refer to Java's definition of an Integer. And as Integer#parseInt accepts tokens like +12, it's a valid Java-Integer.

Regarding the rule, I'm quite sure that +12 was never meant to be accepted. But

Die Bewegungsrichtungen in einer Regel stammen aus der Menge {45, 90, 270, 315}

can be interpreted in two ways:

In the second interpretation, you could once again argue that "+45" means the Java-Integer 45 and 45 ∈ {45, 90, 270, 315}.

Remember that time when Mr. Worsch warned us to always distinguish between symbols and their meaning? ;)

pcworld commented 9 years ago

I thought about this too. An ILIAS question might be good.

Re rules=: From section B:

Eine Regel ist eine Sequenz der Elemente der Menge {45, 90, 270, 315}, die jeweils durch einen Bindestrich separiert sind.

So I think this set is a set of symbols, not integers.

jGleitz commented 9 years ago

Yep, that's a good point. I wish they adopted Mr. Worsch's pattern to style symbols differently…

jGleitz commented 9 years ago

similar to #165, you could argue the same for command parameters!

pcworld commented 9 years ago

@kelunik mentioned in #171:

https://github.com/jGleitz/JUnit-KIT/blob/ant-development/src/final2/subtests/InvalidCommandLineArgumentsTest.java#L130

I think that's not something that should error. +12 is a valid integer.

pcworld commented 9 years ago

I'm currently leaning towards the following interpretation: Allow and explicitly test for leading zeros and + in all commands and in speedup, but disallow and explicitly test leading zeros and + in rule. My reason for the latter is that rules like +45-+45-+45-+45-00045 look really awkward and presumably weren't intended to be valid.

jGleitz commented 9 years ago

See Führende Nullen und + on KIT-ILIAS.

pcworld commented 9 years ago

Thanks for creating the question. As per the response, this won't be tested by Praktomat, so we shouldn't (re)include it in our tests.