depot/pkgs/by-name/np/npiet/tests/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

41 lines
1.3 KiB
Nix

{ fetchurl, callPackage }:
let
# More examples can be found at https://www.dangermouse.net/esoteric/piet/samples.html
hello-program = fetchurl {
url = "https://www.dangermouse.net/esoteric/piet/hw6.png";
hash = "sha256-E8OMu0b/oU8lDF3X4o5WMnnD1IKNT2YF+qe4MXLuczI=";
};
prime-tester-program = fetchurl {
url = "https://www.bertnase.de/npiet/nprime.gif";
hash = "sha256-4eaJweV/n73byoWZWCXiMLkfSEhMPf5itVwz48AK/FA=";
};
brainfuck-interpreter-program = fetchurl {
url = "https://www.dangermouse.net/esoteric/piet/piet_bfi.gif";
hash = "sha256-LIfOG0KFpr4nxAtLLeIsPQl+8Ujyvfz/YnEm/HRoVjY=";
};
in
{
hello = callPackage ./run-test.nix {
testName = "hello";
programPath = hello-program;
expectedOutput = "Hello, world!";
};
prime = callPackage ./run-test.nix {
testName = "prime";
programPath = prime-tester-program;
programInput = "2069";
expectedOutput = "Y";
};
no-prime = callPackage ./run-test.nix {
testName = "no-prime";
programPath = prime-tester-program;
programInput = "2070";
expectedOutput = "N";
};
brainfuck = callPackage ./run-test.nix {
testName = "brainfuck";
programPath = brainfuck-interpreter-program;
programInput = ",+>,+>,+>,+.<.<.<.|sdhO";
expectedOutput = "Piet";
};
}