#include "../include/rcore.h"
#include "tests.h"

/* print the outcome of one independence test in the shared debugging grammar
 * used across the test patterns; cond lists the ncond conditioning nodes (none
 * if ncond is zero). This is the single reference for the debug spacing. */
void debug_test_outcome(const char *x, const char *y, const char **cond,
    int ncond, double pvalue, double alpha) {

  Rprintf("    > node %s is %s %s ", x,
    (pvalue > alpha) ? "independent from" : "dependent on", y);

  if (ncond > 0) {

    Rprintf("given ");
    for (int i = 0; i < ncond; i++)
      Rprintf("%s ", cond[i]);

  }/*THEN*/

  Rprintf("(p-value: %g).\n", pvalue);

}/*DEBUG_TEST_OUTCOME*/
