spigot: add a simple test

This commit is contained in:
Anderson Torres 2023-10-31 00:13:51 -03:00
parent 5ff9d48070
commit 822dd9b460
2 changed files with 28 additions and 0 deletions

View file

@ -1,6 +1,7 @@
{ lib { lib
, stdenv , stdenv
, fetchurl , fetchurl
, callPackage
, cmake , cmake
, gmp , gmp
, halibut , halibut
@ -32,6 +33,12 @@ stdenv.mkDerivation (finalAttrs: {
strictDeps = true; strictDeps = true;
passthru.tests = {
approximation = callPackage ./tests/approximation.nix {
spigot = finalAttrs.finalPackage;
};
};
meta = { meta = {
homepage = "https://www.chiark.greenend.org.uk/~sgtatham/spigot/"; homepage = "https://www.chiark.greenend.org.uk/~sgtatham/spigot/";
description = "A command-line exact real calculator"; description = "A command-line exact real calculator";

View file

@ -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;
}