// Path: src/main/java/com/declarativa/interprolog/util/IPException.java
// @SuppressWarnings("serial")
// public class IPException extends RuntimeException{
// 	private Throwable cause;
// 	
// 	public IPException(String s){
// 		super(s);
// 		//System.err.println("IPException about to be thrown:"+this);
// 		cause=null;
// 	}
//     
//     public IPException(String s, Throwable cause) {
//         super(s);
//         this.cause=cause;
//     }
//     
//     /** To allow compilation under JDK 1.3; this method is already defined in Throwable in later JDKs */
//     public Throwable getCause(){
//     	return cause;
//     }
// }
// 
// Path: src/main/java/com/declarativa/interprolog/util/IPPrologError.java
// @SuppressWarnings("serial")
// public class IPPrologError extends IPException{
// 	public final Object t;
// 	public IPPrologError(Object t){
// 		super(t.toString());
// 		this.t=t;
// 	}
// 	public String toString(){return "IPPrologError:"+t.toString();}
// 	
// 	public Object getError(){return t;}
// }
// 
// Path: src/main/java/com/declarativa/interprolog/util/PrologHaltedException.java
// @SuppressWarnings("serial")
// public class PrologHaltedException extends IPException{
// 	public PrologHaltedException(String s){super(s);}
// 	public PrologHaltedException(String s,Throwable cause){super(s,cause);}
// }
// 
// Path: src/main/java/com/declarativa/interprolog/util/UnavailableResultException.java
// @SuppressWarnings("serial")
// public class UnavailableResultException extends IPException{
// 	public UnavailableResultException(String s){super(s);}
// 	public UnavailableResultException(String s,Throwable cause){super(s,cause);}
// }


import com.declarativa.interprolog.util.IPException;
import com.declarativa.interprolog.util.IPPrologError;
import com.declarativa.interprolog.util.PrologHaltedException;
import com.declarativa.interprolog.util.UnavailableResultException;
			}
			@Override
			public void printStdout(String s) {
			}
			@Override
			public void printStderr(String s) {
			}
		};
		N = buffer.length();
		e.shutdown();
		try{Thread.sleep(500);}catch(Exception ex){}
		// System.out.println("output received:"+buffer.substring(N));
		// try{Thread.sleep(1000);}catch(Exception ex){}
		assertEquals(N,buffer.length());
		// Test unexpected shutdown:
		final SubprocessEngine e2 = (SubprocessEngine)buildNewEngine();
		try{
			e2.deterministicGoal("halt");
			fail("should have thrown PrologHaltedException"); 
		} catch (PrologHaltedException ex){
		}	
	}
	
	public void testUnavailableResultException(){
		(new Thread(){
			public void run(){
				try{
					engine.deterministicGoal("repeat,fail");
					fail("should have thrown PrologHaltedException"); 
				} 
// Path: src/main/java/com/declarativa/interprolog/util/IPException.java
// @SuppressWarnings("serial")
// public class IPException extends RuntimeException{
// 	private Throwable cause;
// 	
// 	public IPException(String s){
// 		super(s);
// 		//System.err.println("IPException about to be thrown:"+this);
// 		cause=null;
// 	}
//     
//     public IPException(String s, Throwable cause) {
//         super(s);
//         this.cause=cause;
//     }
//     
//     /** To allow compilation under JDK 1.3; this method is already defined in Throwable in later JDKs */
//     public Throwable getCause(){
//     	return cause;
//     }
// }
// 
// Path: src/main/java/com/declarativa/interprolog/util/IPPrologError.java
// @SuppressWarnings("serial")
// public class IPPrologError extends IPException{
// 	public final Object t;
// 	public IPPrologError(Object t){
// 		super(t.toString());
// 		this.t=t;
// 	}
// 	public String toString(){return "IPPrologError:"+t.toString();}
// 	
// 	public Object getError(){return t;}
// }
// 
// Path: src/main/java/com/declarativa/interprolog/util/PrologHaltedException.java
// @SuppressWarnings("serial")
// public class PrologHaltedException extends IPException{
// 	public PrologHaltedException(String s){super(s);}
// 	public PrologHaltedException(String s,Throwable cause){super(s,cause);}
// }
// 
// Path: src/main/java/com/declarativa/interprolog/util/UnavailableResultException.java
// @SuppressWarnings("serial")
// public class UnavailableResultException extends IPException{
// 	public UnavailableResultException(String s){super(s);}
// 	public UnavailableResultException(String s,Throwable cause){super(s,cause);}
// }


// Path: src/test/java/com/declarativa/interprolog/SubprocessEngineTest.java
import com.declarativa.interprolog.util.IPException;
import com.declarativa.interprolog.util.IPPrologError;
import com.declarativa.interprolog.util.PrologHaltedException;
import com.declarativa.interprolog.util.UnavailableResultException;

			}
			@Override
			public void printStdout(String s) {
			}
			@Override
			public void printStderr(String s) {
			}
		};
		N = buffer.length();
		e.shutdown();
		try{Thread.sleep(500);}catch(Exception ex){}
		// System.out.println("output received:"+buffer.substring(N));
		// try{Thread.sleep(1000);}catch(Exception ex){}
		assertEquals(N,buffer.length());
		// Test unexpected shutdown:
		final SubprocessEngine e2 = (SubprocessEngine)buildNewEngine();
		try{
			e2.deterministicGoal("halt");
			fail("should have thrown PrologHaltedException"); 
		} catch (PrologHaltedException ex){
		}	
	}
	
	public void testUnavailableResultException(){
		(new Thread(){
			public void run(){
				try{
					engine.deterministicGoal("repeat,fail");
					fail("should have thrown PrologHaltedException"); 
				} 
				catch (UnavailableResultException ex){}