Incorrect test case "Scanning: Identifiers #ey7"

The test case -

{
// This is a complex test case
str1 = "Test"
str2 = "Case"
num1 = 100
num2 = 200.00
result = (str1 == str2) != ((num1 + num2) >= 300)
}

$ ./your_program.sh tokenize test.lox

Logs from your program will appear here!
LEFT_BRACE { null
IDENTIFIER str1 null
EQUAL = null
STRING "Test" Test
IDENTIFIER str2 null
EQUAL = null
STRING "Case" Case
IDENTIFIER num1 null
EQUAL = null
NUMBER 100 100.0
IDENTIFIER num2 null
EQUAL = null
NUMBER 200 200.0
IDENTIFIER result null
EQUAL = null
LEFT_PAREN ( null
IDENTIFIER str1 null
EQUAL_EQUAL == null
IDENTIFIER str2 null
RIGHT_PAREN ) null
BANG_EQUAL != null
LEFT_PAREN ( null
LEFT_PAREN ( null
IDENTIFIER num1 null
PLUS + null
IDENTIFIER num2 null
RIGHT_PAREN ) null
GREATER_EQUAL >= null
NUMBER 300 300.0
RIGHT_PAREN ) null
RIGHT_BRACE } null
EOF  null
remote: [tester::#EY7] [test-4] ✓ LEFT_BRACE { null
remote: [tester::#EY7] [test-4] ✓ IDENTIFIER str1 null
remote: [tester::#EY7] [test-4] ✓ EQUAL = null
remote: [tester::#EY7] [test-4] ✓ STRING "Test" Test
remote: [tester::#EY7] [test-4] ✓ IDENTIFIER str2 null
remote: [tester::#EY7] [test-4] ✓ EQUAL = null
remote: [tester::#EY7] [test-4] ✓ STRING "Case" Case
remote: [tester::#EY7] [test-4] ✓ IDENTIFIER num1 null
remote: [tester::#EY7] [test-4] ✓ EQUAL = null
remote: [tester::#EY7] [test-4] ✓ NUMBER 100 100.0
remote: [tester::#EY7] [test-4] ✓ IDENTIFIER num2 null
remote: [tester::#EY7] [test-4] ✓ EQUAL = null
remote: [tester::#EY7] [test-4] 𐄂 NUMBER 200 200.0
remote: [tester::#EY7] [test-4] Expected line #13 on stdout to be "NUMBER 200.00 200.0", got "NUMBER 200 200.0"
remote: [tester::#EY7] [test-4] Test failed

Should the line not be “NUMBER 200 200.0” and not “NUMBER 200.00 200.0” since the lexeme part of the token stores the number without the decimal point in the case of an integer. What is the purpose of it being “200.00” if not?
For the input “42”, this should be the output according to “Scanning: Number literals” -

$ ./your_program.sh tokenize test.lox
NUMBER 42 42.0
EOF  null

Hi @PinetheApple, I agree that the output for 42 should be NUMBER 42 42.0.

However, the correct output for 200.00 is NUMBER 200.00 200.0.

Feel free to check out my explanation to a similar question for more details.

I read the explanation. I understand what I have to do but it is quite annoying that I have to constantly keep changing the code because of some test case that doesn’t really affect the overall program. For example, I’m currently in the “Statements and State” part of the challenge. I don’t get why I’m being tested on parsing and tokenization anymore.
Thanks for the help though.

Thanks for sharing your thoughts!

Once your code passes the current stage, our test runner will also run it against all previous stages to ensure there are no regressions.

It’s common for later changes to inadvertently break earlier stages. Without regression testing, these issues could go unnoticed, potentially leading to a broken implementation overall.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.