iphreeqc/tests/test_f90.f90
Scott R Charlton 2c4422593b # IPQ_DLL_EXPORT int GetDumpOn(int id);
#	IPQ_DLL_EXPORT int         GetDumpFileOn(int id);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetDumpOn(int id, int dump_on);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetDumpFileOn(int id, int dump_on);
s/etDumpOn/etDumpFileOn/g
s/etdumpon/etdumpfileon/g
s/ETDUMPON/ETDUMPFILEON/g
#	IPQ_DLL_EXPORT int         GetErrorOn(int id);
#	IPQ_DLL_EXPORT int         GetErrorFileOn(int id);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetErrorOn(int id, int error_on);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetErrorFileOn(int id, int error_on);
s/etErrorOn/etErrorFileOn/g
s/eterroron/eterrorfileon/g
s/ETERRORON/ETERRORFILEON/g
#	IPQ_DLL_EXPORT int         GetLogOn(int id);
#	IPQ_DLL_EXPORT int         GetLogFileOn(int id);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetLogOn(int id, int log_on);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetLogFileOn(int id, int log_on);
s/etLogOn/etLogFileOn/g
s/etlogon/etlogfileon/g
s/ETLOGON/ETLOGFILEON/g
#	IPQ_DLL_EXPORT int         GetOutputOn(int id);
#	IPQ_DLL_EXPORT int         GetOutputFileOn(int id);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetOutputOn(int id, int output_on);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetOutputFileOn(int id, int output_on);
s/etOutputOn/etOutputFileOn/g
s/etoutputon/etoutputfileon/g
s/ETOUTPUTON/ETOUTPUTFILEON/g
#	IPQ_DLL_EXPORT int         GetSelectedOutputOn(int id);
#	IPQ_DLL_EXPORT int         GetSelectedOutputFileOn(int id);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetSelectedOutputOn(int id, int sel_on);
#	IPQ_DLL_EXPORT IPQ_RESULT  SetSelectedOutputFileOn(int id, int sel_on);
s/etSelectedOutputOn/etSelectedOutputFileOn/g
s/etselectedoutputon/etselectedoutputfileon/g
s/ETSELECTEDOUTPUTON/ETSELECTEDOUTPUTFILEON/g
#	IPQ_DLL_EXPORT const char* GetDumpLine(int id, int n);
#	IPQ_DLL_EXPORT const char* GetDumpStringLine(int id, int n);
#	IPQ_DLL_EXPORT int         GetDumpLineCount(int id);
#	IPQ_DLL_EXPORT int         GetDumpStringLineCount(int id);
s/GetDumpLine/GetDumpStringLine/g
s/getdumpline/getdumpstringline/g
s/GETDUMPLINE/GETDUMPSTRINGLINE/g
#	IPQ_DLL_EXPORT const char* GetErrorLine(int id, int n);
#	IPQ_DLL_EXPORT const char* GetErrorStringLine(int id, int n);
#	IPQ_DLL_EXPORT int         GetErrorLineCount(int id);
#	IPQ_DLL_EXPORT int         GetErrorStringLineCount(int id);
s/GetErrorLine/GetErrorStringLine/g
s/geterrorline/geterrorstringline/g
s/GETERRORLINE/GETERRORSTRINGLINE/g
#	IPQ_DLL_EXPORT const char* GetWarningLine(int id, int n);
#	IPQ_DLL_EXPORT const char* GetWarningStringLine(int id, int n);
#	IPQ_DLL_EXPORT int         GetWarningLineCount(int id);
#	IPQ_DLL_EXPORT int         GetWarningStringLineCount(int id);
s/GetWarningLine/GetWarningStringLine/g
s/getwarningline/getwarningstringline/g
s/GETWARNINGLINE/GETWARNINGSTRINGLINE/g
#	IPQ_DLL_EXPORT void        OutputError(int id);
#	IPQ_DLL_EXPORT void        OutputErrorString(int id);
s/OutputError/OutputErrorString/g
s/outputerror/outputerrorstring/g
s/OUTPUTERROR/OUTPUTERRORSTRING/g
#	IPQ_DLL_EXPORT void        OutputLines(int id);
#	IPQ_DLL_EXPORT void        OutputAccumulatedLines(int id);
s/OutputLines/OutputAccumulatedLines/g
s/outputlines/outputaccumulatedlines/g
s/OUTPUTLINES/OUTPUTACCUMULATEDLINES/g
#	IPQ_DLL_EXPORT void        OutputWarning(int id);
#	IPQ_DLL_EXPORT void        OutputWarningString(int id);
s/OutputWarning/OutputWarningString/g
s/outputwarning/outputwarningstring/g
s/OUTPUTWARNING/OUTPUTWARNINGSTRING/g


git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@4411 1feff8c3-07ed-0310-ac33-dd36852eb9cd
2010-05-18 01:59:33 +00:00

142 lines
2.8 KiB
Fortran

FUNCTION F_MAIN()
IMPLICIT NONE
INCLUDE 'IPhreeqc.f90.inc'
INTEGER(KIND=4) id
INTEGER(KIND=4) r
INTEGER(KIND=4) c
INTEGER(KIND=4) t
REAL(KIND=8) d
CHARACTER(LEN=80) s
INTEGER(KIND=4) F_MAIN
INTEGER(KIND=4) TestGetSet
INTEGER(KIND=4),PARAMETER :: EXIT_SUCCESS = 0
INTEGER(KIND=4),PARAMETER :: EXIT_FAILURE = 1
id = CreateIPhreeqc()
IF (id.LT.0) THEN
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
! Dump
IF (TestGetSet(id,GetDumpFileOn,SetDumpFileOn).NE.0) THEN
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
! Dump string
IF (TestGetSet(id,GetDumpStringOn,SetDumpStringOn).NE.0) THEN
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
! Error
IF (TestGetSet(id,GetErrorFileOn,SetErrorFileOn).NE.0) THEN
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
! Log
IF (TestGetSet(id,GetLogFileOn,SetLogFileOn).NE.0) THEN
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
! Output
IF (TestGetSet(id,GetOutputFileOn,SetOutputFileOn).NE.0) THEN
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
! Selected output
IF (TestGetSet(id,GetSelectedOutputFileOn,SetSelectedOutputFileOn).NE.0) THEN
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
IF (LoadDatabase(id, "phreeqc.dat").NE.0) THEN
CALL OutputErrorString(id)
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
IF (RunFile(id, "ex2").NE.0) THEN
CALL OutputErrorString(id)
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
DO r=0,GetSelectedOutputRowCount(id)
DO c=1,GetSelectedOutputColumnCount(id)
IF (GetSelectedOutputValue(id,r,c,t,d,s).NE.IPQ_OK) THEN
CALL OutputErrorString(id)
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
ENDDO
ENDDO
IF (DestroyIPhreeqc(id).NE.0) THEN
CALL OutputErrorString(id)
F_MAIN = EXIT_FAILURE
RETURN
ENDIF
F_MAIN = EXIT_SUCCESS
RETURN
END FUNCTION F_MAIN
FUNCTION TestGetSet(id,getFunc,setFunc)
IMPLICIT NONE
INCLUDE 'IPhreeqc.f90.inc'
INTEGER(KIND=4) id
INTEGER(KIND=4) TESTGETSET
INTERFACE
FUNCTION getFunc(id)
INTEGER(KIND=4) id
LOGICAL(KIND=4) getFunc
END FUNCTION getFunc
END INTERFACE
INTERFACE
FUNCTION setFunc(id,flag)
INTEGER(KIND=4) id
LOGICAL(KIND=4) flag
INTEGER(KIND=4) setFunc
END FUNCTION setFunc
END INTERFACE
INTEGER(KIND=4),PARAMETER :: EXIT_SUCCESS = 0
INTEGER(KIND=4),PARAMETER :: EXIT_FAILURE = 1
IF (getFunc(id)) THEN
TestGetSet = EXIT_FAILURE
RETURN
ENDIF
IF (setFunc(id,.TRUE.).NE.IPQ_OK) THEN
TestGetSet = EXIT_FAILURE
RETURN
ENDIF
IF (.NOT.getFunc(id)) THEN
TestGetSet = EXIT_FAILURE
RETURN
ENDIF
IF (setFunc(id,.FALSE.).NE.IPQ_OK) THEN
TestGetSet = EXIT_FAILURE
RETURN
ENDIF
TestGetSet = EXIT_SUCCESS
RETURN
END FUNCTION TestGetSet