js94065 / scomp

Automatically exported from code.google.com/p/scomp
0 stars 0 forks source link

Create Tests for Scanner #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Add JUnit tests for Scanner.
Test different input values for the scanner and make sure they match
expected output.

Original issue reported on code.google.com by js94...@gmail.com on 3 Jun 2010 at 8:36

GoogleCodeExporter commented 9 years ago
You should use DecafParserSymbols constants instead of hardcoded values, 
because the
last change I made to the terminals broke some of the tests.

I disagree with the use of @Test(expected=AssertionError.class).
Assertion errors should be used to indicate that a test fails, and no attempt 
should
be made to silence them.
Also, "throws AssertionError" should be used everywhere or nowhere since it is
implied that JUnit test methods throw AssertionError when tests fail.

I don't understand the purpose of charLiteralIncorrect().
The input is a string literal so you should test what it's supposed to be, and 
not
what it isn't (otherwise, why not test that it is not a int literal or an 
operator?).
Same thing with stringLiteralIncorrect() (the input is an identifier).

I have redefined equals() in DecafToken so it should be easier to compare 
tokens now.

Original comment by codistm...@gmail.com on 7 Jun 2010 at 6:29

GoogleCodeExporter commented 9 years ago

Original comment by js94...@gmail.com on 4 Jul 2010 at 7:32

GoogleCodeExporter commented 9 years ago

Original comment by codistm...@gmail.com on 2 Aug 2010 at 5:46