File difference tool for competitive programming.
go install github.com/ChrisVilches/cpdiff@latestyay -S cpdiffComparing standard input (e.g. some program's output redirected to cpdiff) against a file (e.g. the correct answer):
./my-program < in-file | cpdiff ans-fileOr compare two files:
cpdiff file1 file2Help (see all options):
cpdiff --helpComparing each number individually. Numbers are allowed to have an error:
Comparing strings. Each character is compared individually:
If you want to compare binary strings (or digits), you can compare them character by character instead of comparing their numeric value:
Big numbers are supported. Numbers can have arbitrary precision or amount of digits:
Linting and formatting:
go fmt ./...
revive --formatter stylish ./...In order to run tests, first build the project, then set the environment variable below to the path of the executable:
go build
INTEGRATION_TEST_EXECUTABLE=/path/cpdiff go test ./...Verify installation command works:
IMG=cpdiff-install-test
docker build -t $IMG .
docker run --rm $IMGClean up manually afterwards (i.e. remove images).
Generate screenshots by first installing termshot and then executing the following command:
bash ./screenshots/gen.sh path_to_termshot_executable path_to_cpdiff_executable


