Skip to content

Conversation

@gkreitz
Copy link
Contributor

@gkreitz gkreitz commented Nov 17, 2025

This updates default_validator to avoid creating huge judgemessage.txt when the token containing a difference is huge (e.g., the user forgot to output spaces).

When printing single tokens, we cut after 30 bytes, and when printing two tokens, we print up to 15 bytes of the common prefix ... first 15 bytes from where the strings first differ.

While we can't assume anything about the output encoding, we make a small attempt not to insert our "..." in the middle of a utf-8 character, as that is by far the most commonly used encoding. (You can still get weird efffects here if using composition characters, as I don't want to add a dependency on a full unicode handling library).

Also adds test cases to cover this truncation behavior, plus some more test cases, so we now at least should have one test case per different judgemessage we currently canemit.

Fixes #346

@pehrsoderman pehrsoderman merged commit 16dd35d into Kattis:master Nov 17, 2025
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.

Make default validator truncate long tokens included in judgemessage.txt

2 participants