Skip to content

all-your-base: document the input format and exception messages the tests require - #3183

Closed
Mike-7777777 wants to merge 1 commit into
exercism:mainfrom
Mike-7777777:all-your-base-document-errors
Closed

Mike-7777777 wants to merge 1 commit into
exercism:mainfrom
Mike-7777777:all-your-base-document-errors

Conversation

@Mike-7777777

@Mike-7777777 Mike-7777777 commented Nov 22, 2026 •

Copy link
Copy Markdown

Pull Request

Closes #3185

Three things the all-your-base tests check are not stated anywhere in the exercise:

  • The eight error tests (BaseConverterTest.java:130-206) assert IllegalArgumentException with an exact message: "Bases must be at least 2." (six tests, for both bases), "Digits may not be negative." and "All digits must be strictly less than the base.".
  • empty list (:90-97) expects new int[]{} to convert to [0].
  • multiple zeros and leading zeros (:110-127) expect leading zeros to be accepted.

instructions.md only explains positional notation, there is no instructions.append.md, and the stub gives no hint about exception types or messages. Earlier versions of this exercise's tests required the opposite for the last two points (exceptions "You must supply at least one digit." and "Digits may not contain leading zeros."), so a student who remembers them fails three tests with no way to know why until the test file is opened.

This PR adds .docs/instructions.append.md with an "Input format" section and an "Exception messages" section, the latter in the same format as the Java track's pov exercise (and #3182 for wordy). Tests and the example solution are unchanged.

How I checked it, against the current all-your-base tests on main (20 tests, all enabled):

Solution Result
.meta/src/reference/java/BaseConverter.java 20/20 pass
The unmodified stub 20/20 fail
Two solutions written from instructions.md and the stub alone one fails 5 of 20 (empty list, multiple zeros and leading zeros, where it throws the old exceptions, plus negative digit and invalid positive digit on the message); the other passes 20/20 because it used these exact messages from memory
Two solutions written from instructions.md plus the new instructions.append.md 20/20 pass

The four solutions were written by separate model runs that saw only the docs and the stub, never the tests.

markdownlint-cli2 (the repository's .markdownlint-cli2.jsonc) reports 0 errors.

The same gap shows up when the exercise is used as a hidden-test benchmark (the Aider polyglot benchmark and the Harbor aider_polyglot adapter build their prompts from .docs/instructions*.md): in our evaluation runs, 42 of 60 attempts at this exercise failed. All 42 threw IllegalArgumentException for every invalid input; 25 failed only on the message wording, and the other 17 also rejected the empty array or leading zeros.


Reviewer Resources:

Track Policies

@kahgoh

kahgoh commented Nov 23, 2026

Copy link
Copy Markdown
Member

I am rejecting this one. Exercism uses TDD. Students (not agents or LLMs) are should generally look in the tests to see what the expectations are.

@kahgoh kahgoh closed this Nov 23, 2026
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.

all-your-base: exception messages and empty/leading-zero handling the tests require are not documented

2 participants