this directory contains tests for sp_solve programs

currently, each test compares components of solution from old version with the
corresponding components from solutions using
the code in the newVersion directory

adding a test requires
creating a directory containing
3 matlab related files,
adding the directory to the cvs repository,
adding a few lines to a java program,
testing the tests in unix, committing the changes to the cvs repository
and finally testing the tests on pc with matlab and jmatlink installed.



***************************
you should work with an up to date ***copy*** of the sp_solve directories.
first, cd to your ***private copy*** 
of the sp_solve directory and type
  cvs update.
if you do not have a private copy, cd to your homedir and 
type 
  cvs co sp_solve.
after creating your own sp_solve copy,
you have to instruct matlab to use that copy.
(you may have a matlab init file that
gets you access to the production sp_solve directory.)
you should type
addpath('/fullPathName/your_sp_solve')
early in your matlab session.



*******************
I. matlab related files


create a subdir of tests including three files:

1) a parameter file
2) a model file
3) program comparing the two cofb matrices. 
the program must have the same name as directory
but with a .m at the end.
   

the following code gets the job done. modify three lines referring 
to the three files.  if necessary, modify the tests.

%template for program comparing newVersion cofb and oldVersion cofb
clear all;
%provide 
%name for test pgm(must be dir name and filename without .m added)
testnam='spSolveHabitmod'; 
parnam='habitmodParams';   %name for parameter file
modnam='habitmod';         %name for model file
%each of these file should be in a subdir of tests with name= testnam
%note, running ant substitutes actual path name for @string@ values


dirnam=strcat('/a/mqmx1/lcl/mq/home3/m1bmi00/sp_solve/newVersion/filtered/',testnam,'/');

[newUsed,newInParm,newInCof,newOutParm,newRts,newCofb,newScof]=...
		runOne('/a/mqmx1/lcl/mq/home3/m1bmi00/sp_solve/newVersion/',dirnam,parnam,modnam);
newPgmQ=...
		and(length(findstr(newUsed,'sp_solve'))>0,...
		length(findstr(newUsed,'newVersion'))>0);

[oldUsed,oldInParm,oldInCof,oldOutParm,oldRts,oldCofb,oldScof]=...
		runOne('/a/mqmx1/lcl/mq/home3/m1bmi00/sp_solve/',dirnam,parnam,modnam);
oldPgmQ=...
		and(length(findstr(oldUsed,'sp_solve'))>0,...
		length(findstr(oldUsed,'newVersion'))==0);

inCofQ=matrixMatchQ(newInCof,oldInCof);
cofbQ=matrixMatchQ(newCofb,oldCofb);

%successful test should have last line evaluate to true value (ie 1.0 in matlab)
and(and(and(inCofQ,cofbQ),oldPgmQ),newPgmQ)




ADDING THE FILES TO THE REPOSITORY:
	ADDING NEW DIRECTORY
cd to the directory that will contain your new subdirectory
(currently, cd to .../sp_solve/newVersion/tests)
type
   cvs add NewDirName
this will add the directory to the repository.
Adding the three	
     ADDING 3 MATLAB RELATED FILES
cd to the directory that will contain the files
type
   cvs add NewFileName
hit return and type
    cvs ci -m "comments" NewFileName
hit return
do this for all 3 matlab files.




************
II. java

modify testSPSolve.java in the ../newVersion/tests directory

add lines invoking the new test.
you need to modify three strings.
program name must begin test. remainder of name must make it unique in the
testSPSolve program. do not modify the string name between the @

	/* example code*/
   public void  testSomethingUnique(){/*mod 1 SomethingUnique */
	   String back = JMatLinkTest.scriptReturnsTrue(
"/a/mqmx1/lcl/mq/home3/m1bmi00/sp_solve/newVersion/filtered/yourTestDirName",/*mod 2 yourTestDirName same string as mod 3*/
"yourTestDirName");/*mod 3 yourTestDirName same string as mod 2*/
       assertEquals("True",back);
   }


To send you modified java program to the repository,
cd to .../sp_solve/newVersion/tests
type 
   cvs ci -m "comments" testSPSolve.java
hit return. you changes have been incorporated into the repository.



*********************************************
running the tests
you will need access to ant, junit and jmatlink


on unix

add ~m1gsa00/consolidateHome/jakarta-ant-1.5/bin to your path

setenv CLASSPATH /mq/home/m1gsa00/consolidateHome/jakarta-ant-1.5/lib/ant.jar:/mq/home/m1gsa00/consolidateHome/jakarta-ant-1.5/lib/anttex.jar:/mq/home/m1gsa00/consolidateHome/jakarta-ant-1.5/lib/crimson.jar:/mq/home/m1gsa00/consolidateHome/jakarta-ant-1.5/lib/jaxp.jar
setenv ANT_HOME ~m1gsa00/consolidateHome/jakarta-ant-1.5/bin 
setenv JAVA_HOME /rsma/appl1/java/j2sdk1_3_0/
setenv CHOME /mq/home/m1gsa00/consolidateHome
setenv LD_LIBRARY_PATH /opt/matlab/extern/lib/sol2:${CHOME}/jmatlink

NOTE: Some users may currently have access to java in /usr/bin/java
but the software currently needs $JAVA_HOME (in the setenv statements above) to run. To ensure this happens, the setenv JAVA_HOME statement MUST appear BEFORE the set path statement in your cshrc file.

the build.xml file in the newVersion directory
provides the java classpath definitions for finding the
	java classes




on windows in mq bay area 3124
details under construction...
but the paths and environment variables
should already be established by login process.
