# this is the source of the test file. The test file is produced by:
# gap4r4 init.g ../if_local < tst/pari_gp.src # on Medicis
# gap_dev init.g < tst/pari_gp.src # on my pc
# remove the line 'gap> LogTo();' at the end of the generated file.


LogTo("tst/pari_gp.tst");


# Start

START_TEST( "Test of the 'if' package" );
SizeScreen([80]);;


IF_Interface(IF_pari_gp, "gcd", [1000,360] );



# t_INT

IF_Interface(IF_pari_gp, "omega", [360]);
IF_Interface(IF_pari_gp, "nextprime", [119] );
x:=-10^5000;; x=IF_Interface( IF_pari_gp, "", [x] );
0=IF_Interface( IF_pari_gp, "", [0] );
IF_Interface( IF_pari_gp, "bestappr", [333/106,10] );


# t_REAL

IF_Interface(IF_pari_gp, "sin", [8] );


# t_INTMOD

IF_Interface(IF_pari_gp, "", [ZmodnZObj(8,3)]);
IF_Interface( IF_pari_gp, "Mod", [11,7] );


# t_FRAC

IF_Interface(IF_pari_gp, "", [111/23]);


# t_FRACN

IF_Interface(IF_pari_gp, "type", [6/4, "t_FRACN"] );


# t_COMPLEX

IF_Interface(IF_pari_gp, "", [E(4)]);
IF_Interface(IF_pari_gp, "", [23/34+E(4)*45/67]);
IF_Interface(IF_pari_gp, "conj", [23/34+E(4)*45/67]);


# t_PADIC

fam:=PurePadicNumberFamily(2,7);;
a:=PadicNumber(fam,3/5);
IF_Interface(IF_pari_gp, "", [a]);


# t_QUAD


# t_POLMOD


# t_POL

x_1:=Indeterminate(Rationals);;
IF_Interface(IF_pari_gp, "polcoeff", [44*x_1^3+33*x_1^2+22*x_1+11,2]);
IF_Interface(IF_pari_gp, "", [ 13*x_1^3 + 12*x_1^2 + 11*x_1 + 10]) = 13*x_1^3 + 12*x_1^2 + 11*x_1 + 10;
IF_Interface( IF_pari_gp, "factor", [x_1^3+3*x_1^2+3*x_1+1] ) = [[x_1+1,3]];


x:=Indeterminate(Rationals);;
y:=Indeterminate(Rationals,[x]);;
IF_Interface(IF_pari_gp, "", [11*x^3*y^4+12*x*y+13*x^2*y+14]) = 11*x^3*y^4+12*x*y+13*x^2*y+14;
IF_Interface(IF_pari_gp,"polgalois",[x^4+x*x+5]);

IF_Interface(IF_pari_gp,"algdep",[E(4),3]); # <------------------- could change


# t_SER


# t_RFRAC

IF_Interface(IF_pari_gp, "", [(33*x_1^2+22*x_1+11)/(x_1+x_1^5)]) = (33*x_1^2+22*x_1+11)/(x_1+x_1^5);
IF_Interface(IF_pari_gp,"intformal",[1/(x^2)])= -1/x;


# t_RFRACN

IF_Interface(IF_pari_gp, "type", [(33*x_1^2+22*x_1+11)/(x_1+x_1^5), "t_RFRACN"]) = 
(33*x_1^2+22*x_1+11)/(x_1+x_1^5); 


# t_VEC

IF_Interface(IF_pari_gp, "primes", [10]);
IF_Interface(IF_pari_gp, "length", [[23,34,+E(4),4]]);
IF_Interface(IF_pari_gp, "bernvec", [8]);
IF_Interface( IF_pari_gp, "", "[]" );


# t_COL


# t_MAT

IF_Interface(IF_pari_gp,"factor",[312424]);
IF_Interface(IF_pari_gp,"factorback",[[ [ 2, 3 ], [ 7, 2 ], [ 797, 1 ] ]]);
IF_Interface(IF_pari_gp, "", [[[23,34],[E(4),4]]]);
IF_Interface(IF_pari_gp, "matdet", [[[23,34],[E(4),4]]]);

IF_LowLevelInterface( IF_pari_gp, "m", "", "[11,12,13;21,22,23]" );
IF_LowLevelInterface( IF_pari_gp, "m2", "", "[m,m;m,m]" );
IF_Interface(IF_pari_gp,"","m2");

IF_Interface( IF_pari_gp, "type", [EmptyMatrix(0)] );
IF_Interface( IF_pari_gp, "", [EmptyMatrix(0)] );
IF_Interface( IF_pari_gp, "type", [[[11,22,33]]] );
IF_Interface( IF_pari_gp, "", [[[11,22,33]]] );


# t_STR

chars_ok :=Union([32..126],[128..254]);;
# chars_ok :=Union([32..42],[44,59],[61..126]);; # with OpenMath
for i in chars_ok do
 s1:="";
 Add(s1, CHAR_INT(i));
 s2:=IF_Interface(IF_pari_gp, "Str", [s1] );
 if not s2=s1 then Error(i);fi;
od;


# t_LIST

IF_Interface(IF_pari_gp, "", [[0,1/2,E(4),"ciao",[11,22,33]]]);
IF_Interface( IF_pari_gp, "", [[]] );



# end of test file

STOP_TEST( "test", 10000 );

LogTo();
quit;

