Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync tests for practice exercise ledger #2627

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

manumafe98
Copy link
Contributor

pull request

This issue addresses: #2388

The goal is to sync the tests of the ledger practice exercise

Reviewer Resources:

Track Policies

…s visualized to students, cause this is a reformat exercise
@manumafe98
Copy link
Contributor Author

@sanderploegsma do you know what can be the issue here? Because i'm running the checks locally and seem fine

Manumafe@DESKTOP-GUDFCER MINGW64 /e/repos/java/exercises/practice/ledger (sync-tests-ledger)
$ gradle check

> Task :practice:ledger:compileJava
  (source = E:\repos\java\exercises\practice\ledger\.meta\src\reference\java\Ledger.java)

> Task :practice:ledger:compileTestJava
  (source = E:\repos\java\exercises\practice\ledger\build\gen\test\java\LedgerTest.java)

> Task :practice:ledger:test

LedgerTest > dutchLocaleAndEuros PASSED

LedgerTest > emptyLedgerUS PASSED

LedgerTest > creditAndDebit PASSED

LedgerTest > euros PASSED

LedgerTest > dutchNegativeNumberWith3DigitsBeforeDecimalPoint PASSED

LedgerTest > americanNegativeNumberWith3DigitsBeforeDecimalPoint PASSED

LedgerTest > finalOrderTieBreakerIsChange PASSED

LedgerTest > dutchLocale PASSED

LedgerTest > multipleEntriesOnSameDateOrderedByDescription PASSED

LedgerTest > overlongDescriptions PASSED

LedgerTest > oneEntry PASSED

BUILD SUCCESSFUL in 5s
6 actionable tasks: 6 executed

@sanderploegsma
Copy link
Contributor

You can download the test result artifacts from the GitHub Actions workflow screen to see what is going on. I took a look and found the following test failures. Hope that helps!

Test Error

dutchLocaleAndEuros

Message: Index 1 out of bounds for length 1
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ledger.format(Ledger.java:110)
	at LedgerTest.dutchLocaleAndEuros(LedgerTest.java:152)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

creditAndDebit

Message: Index 1 out of bounds for length 1
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ledger.format(Ledger.java:112)
	at LedgerTest.creditAndDebit(LedgerTest.java:55)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

euros

Message: Index 1 out of bounds for length 1
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ledger.format(Ledger.java:112)
	at LedgerTest.euros(LedgerTest.java:122)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

dutchNegativeNumberWith3DigitsBeforeDecimalPoint

Message: Index 1 out of bounds for length 1
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ledger.format(Ledger.java:110)
	at LedgerTest.dutchNegativeNumberWith3DigitsBeforeDecimalPoint(LedgerTest.java:167)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

americanNegativeNumberWith3DigitsBeforeDecimalPoint

Message: Index 1 out of bounds for length 1
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ledger.format(Ledger.java:112)
	at LedgerTest.americanNegativeNumberWith3DigitsBeforeDecimalPoint(LedgerTest.java:182)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

finalOrderTieBreakerIsChange

Message: Index 1 out of bounds for length 1
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ledger.format(Ledger.java:112)
	at LedgerTest.finalOrderTieBreakerIsChange(LedgerTest.java:90)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

dutchLocale

Message: Index 1 out of bounds for length 1
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ledger.format(Ledger.java:110)
	at LedgerTest.dutchLocale(LedgerTest.java:137)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

multipleEntriesOnSameDateOrderedByDescription

Message: Index 1 out of bounds for length 1
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ledger.format(Ledger.java:112)
	at LedgerTest.multipleEntriesOnSameDateOrderedByDescription(LedgerTest.java:72)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

overlongDescriptions

Message: Index 1 out of bounds for length 1
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ledger.format(Ledger.java:112)
	at LedgerTest.overlongDescriptions(LedgerTest.java:107)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

oneEntry

Message: Index 1 out of bounds for length 1
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ledger.format(Ledger.java:112)
	at LedgerTest.oneEntry(LedgerTest.java:40)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

@manumafe98
Copy link
Contributor Author

Okey so for some reason this line

String[] parts = converted.split("\\.");

Locally was breaking all my tests, so I changed it to comma instead of dot, but here breaks with comma and works with dot. Its weird, do you know what could be causing this @sanderploegsma ?

@manumafe98 manumafe98 changed the title Sync tests from exercise ledger Sync tests for exercise ledger Jan 10, 2024
@manumafe98 manumafe98 changed the title Sync tests for exercise ledger Sync tests for practice exercise ledger Jan 10, 2024
@sanderploegsma
Copy link
Contributor

I tried running the tests for the ledger exercise on my local machine and they failed as well. I suspect it has to do with the locale of the machine the tests are running on. The test runner probably uses the en-US locale by default, and so the exercise and tests have been implemented based on that assumption. My machine's locale is set to nl-NL, I can imagine that you also have a non-US locale set?

This would mean that students attempting to solve this exercise locally may run into the same issue, depending on their locale settings. That sounds like a bug in the exercise, so perhaps it should be looked into in a new issue.

@manumafe98
Copy link
Contributor Author

I tried running the tests for the ledger exercise on my local machine and they failed as well. I suspect it has to do with the locale of the machine the tests are running on. The test runner probably uses the en-US locale by default, and so the exercise and tests have been implemented based on that assumption. My machine's locale is set to nl-NL, I can imagine that you also have a non-US locale set?

This would mean that students attempting to solve this exercise locally may run into the same issue, depending on their locale settings. That sounds like a bug in the exercise, so perhaps it should be looked into in a new issue.

Ohh that makes sense! yes, I have a non us locale

@sanderploegsma sanderploegsma merged commit 0ef4420 into exercism:main Jan 11, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants