diff --git a/pkgs/by-name/sp/spigot/package.nix b/pkgs/by-name/sp/spigot/package.nix index 5f50307537b6..421af163cd4f 100644 --- a/pkgs/by-name/sp/spigot/package.nix +++ b/pkgs/by-name/sp/spigot/package.nix @@ -1,6 +1,7 @@ { lib , stdenv , fetchurl +, callPackage , cmake , gmp , halibut @@ -32,6 +33,12 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; + passthru.tests = { + approximation = callPackage ./tests/approximation.nix { + spigot = finalAttrs.finalPackage; + }; + }; + meta = { homepage = "https://www.chiark.greenend.org.uk/~sgtatham/spigot/"; description = "A command-line exact real calculator"; diff --git a/pkgs/by-name/sp/spigot/tests/approximation.nix b/pkgs/by-name/sp/spigot/tests/approximation.nix new file mode 100644 index 000000000000..ffb329e6a317 --- /dev/null +++ b/pkgs/by-name/sp/spigot/tests/approximation.nix @@ -0,0 +1,21 @@ +{ lib +, stdenv +, spigot +}: + +stdenv.mkDerivation { + pname = "spigot-approximation"; + inherit (spigot) version; + + nativeBuildInputs = [ spigot ]; + + dontInstall = true; + + buildCommand = '' + [ "$(spigot -b2 -d32 '(pi/1-355/113)')" = "-0.00000000000000000000010001111001" ] + [ "$(spigot -b2 -d32 '(e/1-1457/536)')" = "-0.00000000000000000001110101101011" ] + touch $out + ''; + + meta.timeout = 10; +}