mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
# 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
121 lines
2.5 KiB
C++
121 lines
2.5 KiB
C++
#include <cstdlib>
|
|
#include <iostream>
|
|
#include <IPhreeqc.hpp>
|
|
|
|
template <class TClass> class TTestGetSet
|
|
{
|
|
private:
|
|
bool (TClass::*_get)(void)const;
|
|
void (TClass::*_set)(bool);
|
|
TClass* _p;
|
|
public:
|
|
TTestGetSet(TClass* p, bool(TClass::*get)(void)const, void(TClass::*set)(bool))
|
|
{
|
|
_p = p;
|
|
_get = get;
|
|
_set = set;
|
|
}
|
|
int Test(void)
|
|
{
|
|
if ((*_p.*_get)())
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
(*_p.*_set)(true);
|
|
|
|
if (!(*_p.*_get)())
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
(*_p.*_set)(false);
|
|
|
|
if ((*_p.*_get)())
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|
|
};
|
|
|
|
int
|
|
main(int argc, const char* argv[])
|
|
{
|
|
IPhreeqc iphreeqc;
|
|
|
|
// Dump
|
|
TTestGetSet<IPhreeqc> testDump(&iphreeqc, &IPhreeqc::GetDumpFileOn, &IPhreeqc::SetDumpFileOn);
|
|
if (testDump.Test() != EXIT_SUCCESS)
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
// Dump string
|
|
TTestGetSet<IPhreeqc> testDumpString(&iphreeqc, &IPhreeqc::GetDumpStringOn, &IPhreeqc::SetDumpStringOn);
|
|
if (testDumpString.Test() != EXIT_SUCCESS)
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
// Error
|
|
TTestGetSet<IPhreeqc> testError(&iphreeqc, &IPhreeqc::GetErrorFileOn, &IPhreeqc::SetErrorFileOn);
|
|
if (testError.Test() != EXIT_SUCCESS)
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
// Log
|
|
TTestGetSet<IPhreeqc> testLog(&iphreeqc, &IPhreeqc::GetLogFileOn, &IPhreeqc::SetLogFileOn);
|
|
if (testLog.Test() != EXIT_SUCCESS)
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
// Output
|
|
TTestGetSet<IPhreeqc> testOutput(&iphreeqc, &IPhreeqc::GetOutputFileOn, &IPhreeqc::SetOutputFileOn);
|
|
if (testOutput.Test() != EXIT_SUCCESS)
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
// Selected output
|
|
TTestGetSet<IPhreeqc> testSelectedOutput(&iphreeqc, &IPhreeqc::GetSelectedOutputFileOn, &IPhreeqc::SetSelectedOutputFileOn);
|
|
if (testSelectedOutput.Test() != EXIT_SUCCESS)
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
if (iphreeqc.LoadDatabase("phreeqc.dat") != 0)
|
|
{
|
|
std::cout << iphreeqc.GetErrorString();
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
if (iphreeqc.RunFile("ex2") != 0)
|
|
{
|
|
std::cout << iphreeqc.GetErrorString();
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
for (int r = 0; r < iphreeqc.GetSelectedOutputRowCount(); ++r)
|
|
{
|
|
for (int c = 0; c < iphreeqc.GetSelectedOutputColumnCount(); ++c)
|
|
{
|
|
VAR v;
|
|
if (iphreeqc.GetSelectedOutputValue(r, c, &v) != VR_OK)
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
if (VarClear(&v) != VR_OK)
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|