Fix test/ folder: tests of C code run fine now
[valse.git] / test / test.EMGLLF.c
index 168f81e..68f73d9 100644 (file)
@@ -23,7 +23,7 @@ int main(int argc, char** argv)
        Real lambda = read_real("lambda");
        Real* X = readArray_real("X");
        Real* Y = readArray_real("Y");
-       Real tau = read_real("tau");
+       Real eps = read_real("eps");
        ////////////
 
        /////////////
@@ -31,14 +31,15 @@ int main(int argc, char** argv)
        Real* phi = (Real*)malloc(p*m*k*sizeof(Real));
        Real* rho = (Real*)malloc(m*m*k*sizeof(Real));
        Real* pi = (Real*)malloc(k*sizeof(Real));
-       Real* LLF = (Real*)malloc(maxi*sizeof(Real));
+       Real llh;
        Real* S = (Real*)malloc(p*m*k*sizeof(Real));
+       int* affec = (int*)malloc(n*sizeof(int));
        /////////////
 
        ////////////////////
        // Call to EMGLLF //
-       EMGLLF_core(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,lambda,X,Y,tau,
-               phi,rho,pi,LLF,S,
+       EMGLLF_core(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,lambda,X,Y,eps,
+               phi,rho,pi,&llh,S,affec,
                n,p,m,k);
        ////////////////////
 
@@ -65,15 +66,18 @@ int main(int argc, char** argv)
        free(pi);
        free(ref_pi);
 
-       Real* ref_LLF = readArray_real("LLF");
-       compareArray_real("LLF", LLF, ref_LLF, maxi);
-       free(LLF);
-       free(ref_LLF);
+       Real ref_llh = read_real("llh");
+       compareArray_real("llh", &llh, &ref_llh, 1);
 
        Real* ref_S = readArray_real("S");
        compareArray_real("S", S, ref_S, p*m*k);
        free(S);
        free(ref_S);
 
+       int* ref_affec = readArray_int("affec");
+       compareArray_int("affec", affec, ref_affec, n);
+       free(affec);
+       free(ref_affec);
+
        return 0;
 }