# \#KJ0 | Test is not reproducible in number literal stage of interpreter challenge

**URL:** <https://forum.codecrafters.io/t/kj0-test-is-not-reproducible-in-number-literal-stage-of-interpreter-challenge/1671>\
**Category:** Challenges\
**Tags:** challenge:interpreter\
**Created:** [September 9, 2024, 10:53am UTC](https://forum.codecrafters.io/t/kj0-test-is-not-reproducible-in-number-literal-stage-of-interpreter-challenge/1671 "2024-09-09T10:53:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfvillablanca](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jfvillablanca/32/1577_2.png) [@jfvillablanca](https://forum.codecrafters.io/u/jfvillablanca)\
**Post date:** [September 9, 2024, 10:53am UTC](https://forum.codecrafters.io/t/kj0-test-is-not-reproducible-in-number-literal-stage-of-interpreter-challenge/1671/1 "2024-09-09T10:53:13Z")

</div>

For Stage #KJ0, it’s possible to pass the test if the random numbers somehow doesn’t include a trailing zero

Sometimes my code passes if I get “lucky” with the random number even if I deliberately comment out the code that handles the trailing zero.

there should be an explicit test case for the trailing zero requirement

error logs:

```auto
[tester::#KJ0] [test-2] Expected line #1 on stdout to be "NUMBER 42.40 42.4", got "NUMBER 42.4 42.4"

```

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [September 10, 2024, 6:03pm UTC](https://forum.codecrafters.io/t/kj0-test-is-not-reproducible-in-number-literal-stage-of-interpreter-challenge/1671/2 "2024-09-10T18:03:32Z")

</div>

Let’s first review what a [lexeme](https://craftinginterpreters.com/scanning.html#lexemes-and-tokens) is:

> The lexemes are the raw substrings of the source code.

Then the structure of a [token](https://craftinginterpreters.com/scanning.html#location-information):

```java
class Token {
  final TokenType type;
  final String lexeme;
  final Object literal;

  public String toString() {
    return type + " " + lexeme + " " + literal;
  }
}

```

In the case of “NUMBER `42.40` 42.4”, the lexeme is `"42.40"`. It is just a raw string from the source code, and you don’t need to change it in any way:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/1/10ec9d07cda342e93e4cb2aedf81ad38b7143478.png)

Does this make sense?

---

<div class="post-metadata">

**Author:** ![jfvillablanca](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jfvillablanca/32/1577_2.png) [@jfvillablanca](https://forum.codecrafters.io/u/jfvillablanca)\
**Post date:** [September 11, 2024, 1:27pm UTC](https://forum.codecrafters.io/t/kj0-test-is-not-reproducible-in-number-literal-stage-of-interpreter-challenge/1671/3 "2024-09-11T13:27:40Z")

</div>

Yes, thanks for the clarification.

However, I think my concern is still valid because I initially had a successful `codecrafters test` then when I tried to run the test again it failed even though I just added a debug print.

So that meant my code was wrong but the test also gave a false positive when it succeeded initially. Am I correct?

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [September 12, 2024, 3:13pm UTC](https://forum.codecrafters.io/t/kj0-test-is-not-reproducible-in-number-literal-stage-of-interpreter-challenge/1671/4 "2024-09-12T15:13:41Z")

</div>

Yes, you’re right! Sorry I didn’t understand your point completely, but now I do.

We’re adding a test case in this [PR](https://github.com/codecrafters-io/interpreter-tester/pull/41).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [October 4, 2024, 1:43am UTC](https://forum.codecrafters.io/t/kj0-test-is-not-reproducible-in-number-literal-stage-of-interpreter-challenge/1671/5 "2024-10-04T01:43:03Z")

</div>

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