/**********************************************************
 * 
 * This is a benchmark for local_square_classes.m
 * 
 * It compares the times the new algorithm versus
 * the built-in one on the fields with the generating
 * polys (x - 1)^d + 2. Such field are always totally 
 * ramified.
 * 
 *********************************************************/

SetDebugOnError(true);

// initial numbers of test
N1 := 2^8;
M1 := 2^15;
N2 := 2^18;
N3 := 2^14;

QQ := Rationals();
ZZ := Integers();
RR := RealField(8);
Qx<x> := PolynomialRing(QQ);

// maximal degree to be testes
MAX_DEG := 100;
// generating polynomials
polys := [ (x - 1)^d + 2 : d in [ 2..MAX_DEG ] ];

///////////////////////////////////////////////////////////
// perform the tests in Magma
//

// set the path to the package
import "path.m" : PATH_TO_LSC;
Attach(PATH_TO_LSC);

// file to store the results
I := POpen("date", "r");
date := Read(I);
date := Split(date, ", ");
filename := "totally_ramified_magma_" cat date[4] cat "_" cat date[3] cat "_" cat date[2] cat ".dat";
F := Open(filename, "w");
fprintf F, "deg\tt1\tN1\tu1\tM1\tt2\tu2\tN2\tt3\tu3\tN3\n"; 

// import the test suite
import "libtest.m" : runtests;

// run the tests
for f in polys do
    runtests(f, F, ~N1, ~M1, ~N2, ~N3);
end for;

delete F;

quit;
