/*******************************************************************
* A temporary main class for testing ArgsChecker
********************************************************************/

public class Build
{
	/***********************************************************
	* A main that just calls the test method.
	***********************************************************/
	public static void main(String args[])
	{
		testArgsChecker();
	}

	/***********************************************************
	* A test of the ArgsChecker class.
	***********************************************************/
	public static void testArgsChecker()
	{
		ArgsChecker	ac1;
		ArgsChecker	ac2;

		Check.reportPass = true;

		//----------------------
		// Test the constructor
		//----------------------
		ac1 = new ArgsChecker("Test1", 0, 1, "[ arg ]");
		Check.expect(ac1.toString(), "Test1,simple=,param=,cnt=0/1:set=:status=-1,bad=\0");

		//---------------------------------------------------------
		// Test the addSimpleFlag.  Note that toString outputs the
		// flag letters set in alphabetical order, not in the order
		// they were added.  See the second Check.expect below.
		//---------------------------------------------------------
		ac1.addSimpleFlag('w', "Descript of w flag");
		Check.expect(ac1.toString(), "Test1,simple=w,param=,cnt=0/1:set=:status=-1,bad=\0");
		ac1.addSimpleFlag('Z', "Descript of Z flag");
		Check.expect(ac1.toString(), "Test1,simple=Zw,param=,cnt=0/1:set=:status=-1,bad=\0");
		ac1.addSimpleFlag('l', "Descript of Z flag");
		Check.expect(ac1.toString(), "Test1,simple=Zlw,param=,cnt=0/1:set=:status=-1,bad=\0");

		//---------------------------------------------------------
		// Test the addParamFlag.  
		//---------------------------------------------------------
		ac1.addParamFlag('a', "Descript of a flag");
		Check.expect(ac1.toString(), "Test1,simple=Zlw,param=a,cnt=0/1:set=:status=-1,bad=\0");
		ac1.addParamFlag('m', "Descript of m flag");
		Check.expect(ac1.toString(), "Test1,simple=Zlw,param=am,cnt=0/1:set=:status=-1,bad=\0");

		//---------------------------------------------------------
		// Test the isSimpleFlag.
		// Note how a second ArgsChecker object was created.
		// To properly test this method, more than one ArgsChecker
		// objects were needed.
		//---------------------------------------------------------
		ac2 = new ArgsChecker("Test2", 0, 0, "");
		Check.expect(ac1.isSimpleFlag('l'), true);	// A simple flag
		Check.expect(ac1.isSimpleFlag('a'), false);	// A param flag
		Check.expect(ac1.isSimpleFlag('b'), false);	// Not a flag
		Check.expect(ac2.isSimpleFlag('l'), false);	// No flags at all
	}
}
