public static int test(String testname) throws IOException { //reduced error message verboseDebug = false; verboseSugar = false; verboseGc = false; verboseCode = false; CTX konoha = new CTX();//TODO konoha_t(CTX) konoha = konoha_open(); if (startupScript != null) { startup (konoha, startupScript); } int ret = 0;//OK String scriptFile = new String(testname); String correctFile = new String(scriptFile); String resultFile = new String(scriptFile); FileReader fp = new FileReader(correctFile); stdlog.write(resultFile); //TODO ((struct _klib2*)konoha->lib2)->Kreport = kreport; //TODO ((struct _klib2*)konoha->lib2)->Kreportf = kreportf; load(konoha, "Q.E.D.\n");//Q.E.D. stdlog.close(); if (fp != null) { //TODO Not need? FileReader fp2 = new FileReader (resultFile); ret = checkResult(fp, fp2); if (ret == 0) stdout.write("[PASS]:" + testname + "\n");//TODO How to do stdout? fp.close(); fp2.close(); } else { ret = 1; } konohaClose(konoha);//TODO return ret; }
public static int checkResult(FileReader fp0, FileReader fp1) {//used in test. Compare fp0 between fp1 //TODO if ( fp0.equals(fp1) ) return 0; else return 1;//FAILED }