/*****
 NAME
 	ccmdexit-test.m - test program for CCmdExit class
 VERSION
 	$Id$
 CHANGELOG
	$Log$
 */

#include <coconut/ccmdexit.h>
#include <coconut/cint.h>
#include <coconut/cexpconst.h>
#include <coconut/cindtstream.h>

int main()
{
	id <PIndentStream>	stream ;
	id <PCmdExit>		cmd ;
	id <PNumber>		num ;
	id <PExp>		exp ;
	id <PError>		result ;

	printf("***** test program for CCmdExit class\n") ;
	stream = [[CIndtStream alloc] init] ;

	printf("allocate constant:\n") ; fflush(stdout) ;
	num = [[CInt alloc] init] ; 
	[num setInt: 0] ;
	[num print: stream] ;
	[stream putChar: '\n'] ;
	[stream flush] ;

	printf("allocate expression:\n") ; fflush(stdout) ;
	exp = [[CExpConst alloc] initExpConst: num] ;
	[exp print: stream] ;
	[stream putChar: '\n'] ;
	[stream flush] ;

	cmd = [[CCmdExit alloc] init] ;
	[cmd setExp: exp] ;
	result = [cmd exec: nil with: nil] ;
	if(result)
		printf("result : code %x\n", [result code]) ;
	else
		printf("result : none\n") ;
	printf("bye\n") ;
	return 0 ;
}

