ginac: Test using example

Build and run an example program from the ginac documentation.
This commit is contained in:
connordennyomalley
2026-05-18 15:56:09 +01:00
committed by Connor O'Malley
parent 50313ffaab
commit eb64f95d20
2 changed files with 39 additions and 0 deletions
@@ -0,0 +1,36 @@
{
runCommand,
gccStdenv,
cln,
ginac,
}:
runCommand "ginac-example-test"
{
nativeBuildInputs = [
gccStdenv.cc
ginac
cln
];
}
''
echo "
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;
int main() {
symbol x(\"x\"), y(\"y\");
ex poly;
for (int i=0; i<3; ++i) {
poly += factorial(i+16)*pow(x,i)*pow(y,2-i);
}
cout << poly << endl;
return 0;
}" > hello.cc
c++ -lginac -lcln hello.cc -o hello
./hello
mkdir $out
''
+3
View File
@@ -2,6 +2,7 @@
lib,
stdenv,
gccStdenv,
callPackage,
fetchurl,
cln,
pkg-config,
@@ -36,6 +37,8 @@ gccStdenv.mkDerivation (finalAttrs: {
configureFlags = [ "--disable-rpath" ];
passthru.tests.example = callPackage ./ginac-example-test.nix { ginac = finalAttrs.finalPackage; };
meta = {
description = "GiNaC C++ library for symbolic manipulations";
homepage = "https://www.ginac.de/";