mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
changed exit status
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@4351 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
c973500dfd
commit
076faf68b4
@ -1,3 +1,4 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
#include <IPhreeqc.h>
|
#include <IPhreeqc.h>
|
||||||
|
|
||||||
typedef int (*getFunc)(int);
|
typedef int (*getFunc)(int);
|
||||||
@ -12,65 +13,64 @@ main(int argc, const char* argv[])
|
|||||||
id = CreateIPhreeqc();
|
id = CreateIPhreeqc();
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
{
|
{
|
||||||
return 1;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump */
|
/* Dump */
|
||||||
if (TestGetSet(id, GetDumpOn, SetDumpOn))
|
if (TestGetSet(id, GetDumpOn, SetDumpOn))
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump string */
|
/* Dump string */
|
||||||
if (TestGetSet(id, GetDumpStringOn, SetDumpStringOn))
|
if (TestGetSet(id, GetDumpStringOn, SetDumpStringOn))
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Error */
|
/* Error */
|
||||||
if (TestGetSet(id, GetErrorOn, SetErrorOn))
|
if (TestGetSet(id, GetErrorOn, SetErrorOn))
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Log */
|
/* Log */
|
||||||
if (TestGetSet(id, GetLogOn, SetLogOn))
|
if (TestGetSet(id, GetLogOn, SetLogOn))
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output */
|
/* Output */
|
||||||
if (TestGetSet(id, GetOutputOn, SetOutputOn))
|
if (TestGetSet(id, GetOutputOn, SetOutputOn))
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Selected output */
|
/* Selected output */
|
||||||
if (TestGetSet(id, GetSelectedOutputOn, SetSelectedOutputOn))
|
if (TestGetSet(id, GetSelectedOutputOn, SetSelectedOutputOn))
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LoadDatabase(id, "phreeqc.dat") != 0)
|
if (LoadDatabase(id, "phreeqc.dat") != 0)
|
||||||
{
|
{
|
||||||
OutputError(id);
|
OutputError(id);
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RunFile(id, "ex1") != 0)
|
if (RunFile(id, "ex1") != 0)
|
||||||
{
|
{
|
||||||
OutputError(id);
|
OutputError(id);
|
||||||
return 3;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DestroyIPhreeqc(id) != IPQ_OK)
|
if (DestroyIPhreeqc(id) != IPQ_OK)
|
||||||
{
|
{
|
||||||
OutputError(id);
|
OutputError(id);
|
||||||
return 4;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -78,23 +78,23 @@ TestGetSet(int id, getFunc gf, setFunc sf)
|
|||||||
{
|
{
|
||||||
if (gf(id))
|
if (gf(id))
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sf(id, 1) != IPQ_OK)
|
if (sf(id, 1) != IPQ_OK)
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gf(id))
|
if (!gf(id))
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sf(id,0) != IPQ_OK)
|
if (sf(id,0) != IPQ_OK)
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <IPhreeqc.hpp>
|
#include <IPhreeqc.hpp>
|
||||||
|
|
||||||
@ -18,17 +19,17 @@ public:
|
|||||||
{
|
{
|
||||||
if ((*_p.*_get)())
|
if ((*_p.*_get)())
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
(*_p.*_set)(true);
|
(*_p.*_set)(true);
|
||||||
if (!(*_p.*_get)())
|
if (!(*_p.*_get)())
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
(*_p.*_set)(false);
|
(*_p.*_set)(false);
|
||||||
if ((*_p.*_get)())
|
if ((*_p.*_get)())
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -43,55 +44,55 @@ main(int argc, const char* argv[])
|
|||||||
TTestGetSet<IPhreeqc> testDump(&iphreeqc, &IPhreeqc::GetDumpOn, &IPhreeqc::SetDumpOn);
|
TTestGetSet<IPhreeqc> testDump(&iphreeqc, &IPhreeqc::GetDumpOn, &IPhreeqc::SetDumpOn);
|
||||||
if (testDump.Test() != 0)
|
if (testDump.Test() != 0)
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump string
|
// Dump string
|
||||||
TTestGetSet<IPhreeqc> testDumpString(&iphreeqc, &IPhreeqc::GetDumpStringOn, &IPhreeqc::SetDumpStringOn);
|
TTestGetSet<IPhreeqc> testDumpString(&iphreeqc, &IPhreeqc::GetDumpStringOn, &IPhreeqc::SetDumpStringOn);
|
||||||
if (testDumpString.Test() != 0)
|
if (testDumpString.Test() != 0)
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error
|
// Error
|
||||||
TTestGetSet<IPhreeqc> testError(&iphreeqc, &IPhreeqc::GetErrorOn, &IPhreeqc::SetErrorOn);
|
TTestGetSet<IPhreeqc> testError(&iphreeqc, &IPhreeqc::GetErrorOn, &IPhreeqc::SetErrorOn);
|
||||||
if (testError.Test() != 0)
|
if (testError.Test() != 0)
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
TTestGetSet<IPhreeqc> testLog(&iphreeqc, &IPhreeqc::GetLogOn, &IPhreeqc::SetLogOn);
|
TTestGetSet<IPhreeqc> testLog(&iphreeqc, &IPhreeqc::GetLogOn, &IPhreeqc::SetLogOn);
|
||||||
if (testLog.Test() != 0)
|
if (testLog.Test() != 0)
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output
|
// Output
|
||||||
TTestGetSet<IPhreeqc> testOutput(&iphreeqc, &IPhreeqc::GetOutputOn, &IPhreeqc::SetOutputOn);
|
TTestGetSet<IPhreeqc> testOutput(&iphreeqc, &IPhreeqc::GetOutputOn, &IPhreeqc::SetOutputOn);
|
||||||
if (testOutput.Test() != 0)
|
if (testOutput.Test() != 0)
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Selected output
|
// Selected output
|
||||||
TTestGetSet<IPhreeqc> testSelectedOutput(&iphreeqc, &IPhreeqc::GetSelectedOutputOn, &IPhreeqc::SetSelectedOutputOn);
|
TTestGetSet<IPhreeqc> testSelectedOutput(&iphreeqc, &IPhreeqc::GetSelectedOutputOn, &IPhreeqc::SetSelectedOutputOn);
|
||||||
if (testSelectedOutput.Test() != 0)
|
if (testSelectedOutput.Test() != 0)
|
||||||
{
|
{
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iphreeqc.LoadDatabase("phreeqc.dat") != 0)
|
if (iphreeqc.LoadDatabase("phreeqc.dat") != 0)
|
||||||
{
|
{
|
||||||
std::cout << iphreeqc.GetErrorString();
|
std::cout << iphreeqc.GetErrorString();
|
||||||
return 1;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iphreeqc.RunFile("ex1") != 0)
|
if (iphreeqc.RunFile("ex1") != 0)
|
||||||
{
|
{
|
||||||
std::cout << iphreeqc.GetErrorString();
|
std::cout << iphreeqc.GetErrorString();
|
||||||
return 2;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user