# Mutually contradictory test cases for #HT8 vs #LV1

**URL:** <https://forum.codecrafters.io/t/mutually-contradictory-test-cases-for-ht8-vs-lv1/3475>\
**Category:** Challenges\
**Tags:** challenge:interpreter\
**Created:** [December 15, 2024, 11:41am UTC](https://forum.codecrafters.io/t/mutually-contradictory-test-cases-for-ht8-vs-lv1/3475 "2024-12-15T11:41:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jainsau](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jainsau/32/3509_2.png) [@jainsau](https://forum.codecrafters.io/u/jainsau)\
**Post date:** [December 15, 2024, 11:41am UTC](https://forum.codecrafters.io/t/mutually-contradictory-test-cases-for-ht8-vs-lv1/3475/1 "2024-12-15T11:41:06Z")

</div>

Hi there,

It seems that there is a mutual contradiction between tests for stages #HT8 and #LV1. Can you please clarify the gap in my understanding?

Here’s the test that fails:

```auto
[tester::#HT8] [test-3] Running test case: 3
[tester::#HT8] [test-3] Writing contents to ./test.lox:
[tester::#HT8] [test-3] [test.lox] 23 == 20
[tester::#HT8] [test-3] $ ./your_program.sh parse test.lox
[your_program] (== 23 20)
[tester::#HT8] [test-3] 𐄂 (== 23 20)
[tester::#HT8] [test-3] Expected line #1 on stdout to be "(== 23.0 20.0)", got "(== 23 20)"
[tester::#HT8] [test-3] Test failed

```

Here’s the test that passes:

```auto
[tester::#LV1] Running tests for Stage #LV1 (Evaluating Expressions - Literals: Strings & Numbers)                                                                                                                                                                                
[tester::#LV1] [test-1] Running test case: 1                                                                                                                                                                                                                                      
[tester::#LV1] [test-1] Writing contents to ./test.lox:                                                                                                                                                                                                                           
[tester::#LV1] [test-1] [test.lox] 23                                                                                                                                                                                                                                             
[tester::#LV1] [test-1] $ ./your_program.sh evaluate test.lox                                                                                                                                                                                                                     
[your_program] 23
[tester::#LV1] [test-1] ✓ 1 line(s) match on stdout                                                                                                                                                                                                                               
[tester::#LV1] [test-1] ✓ Received exit code 0.                                                                                                                                                                                                                                   

```

Thanks,

---

<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:** [December 15, 2024, 1:34pm UTC](https://forum.codecrafters.io/t/mutually-contradictory-test-cases-for-ht8-vs-lv1/3475/2 "2024-12-15T13:34:23Z")

</div>

Hi @jainsau, the difference in how integers are represented between the parser and the evaluator is an (arguably inconsistent) design choice made by the author of the Lox language.

Here are the reference tests provided by the author:

- [parse](https://github.com/munificent/craftinginterpreters/blob/01e6f5b8f3e5dfa65674c2f9cf4700d73ab41cf8/test/expressions/parse.lox)
- [evaluate](https://github.com/munificent/craftinginterpreters/blob/01e6f5b8f3e5dfa65674c2f9cf4700d73ab41cf8/test/expressions/evaluate.lox)

---

<div class="post-metadata">

**Author:** ![jainsau](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jainsau/32/3509_2.png) [@jainsau](https://forum.codecrafters.io/u/jainsau)\
**Post date:** [December 18, 2024, 1:13am UTC](https://forum.codecrafters.io/t/mutually-contradictory-test-cases-for-ht8-vs-lv1/3475/3 "2024-12-18T01:13:59Z")

</div>

Thanks. This is not ideal but your response helps.

---

<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:** [December 23, 2024, 1:14am UTC](https://forum.codecrafters.io/t/mutually-contradictory-test-cases-for-ht8-vs-lv1/3475/4 "2024-12-23T01:14:58Z")

</div>

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