mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +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>
|
||||
|
||||
typedef int (*getFunc)(int);
|
||||
@ -12,65 +13,64 @@ main(int argc, const char* argv[])
|
||||
id = CreateIPhreeqc();
|
||||
if (id < 0)
|
||||
{
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Dump */
|
||||
if (TestGetSet(id, GetDumpOn, SetDumpOn))
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Dump string */
|
||||
if (TestGetSet(id, GetDumpStringOn, SetDumpStringOn))
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/* Error */
|
||||
if (TestGetSet(id, GetErrorOn, SetErrorOn))
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Log */
|
||||
if (TestGetSet(id, GetLogOn, SetLogOn))
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
if (TestGetSet(id, GetOutputOn, SetOutputOn))
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Selected output */
|
||||
if (TestGetSet(id, GetSelectedOutputOn, SetSelectedOutputOn))
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (LoadDatabase(id, "phreeqc.dat") != 0)
|
||||
{
|
||||
OutputError(id);
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (RunFile(id, "ex1") != 0)
|
||||
{
|
||||
OutputError(id);
|
||||
return 3;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (DestroyIPhreeqc(id) != IPQ_OK)
|
||||
{
|
||||
OutputError(id);
|
||||
return 4;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
@ -78,23 +78,23 @@ TestGetSet(int id, getFunc gf, setFunc sf)
|
||||
{
|
||||
if (gf(id))
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (sf(id, 1) != IPQ_OK)
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!gf(id))
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
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 <IPhreeqc.hpp>
|
||||
|
||||
@ -18,17 +19,17 @@ public:
|
||||
{
|
||||
if ((*_p.*_get)())
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
(*_p.*_set)(true);
|
||||
if (!(*_p.*_get)())
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
(*_p.*_set)(false);
|
||||
if ((*_p.*_get)())
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -43,55 +44,55 @@ main(int argc, const char* argv[])
|
||||
TTestGetSet<IPhreeqc> testDump(&iphreeqc, &IPhreeqc::GetDumpOn, &IPhreeqc::SetDumpOn);
|
||||
if (testDump.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Dump string
|
||||
TTestGetSet<IPhreeqc> testDumpString(&iphreeqc, &IPhreeqc::GetDumpStringOn, &IPhreeqc::SetDumpStringOn);
|
||||
if (testDumpString.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Error
|
||||
TTestGetSet<IPhreeqc> testError(&iphreeqc, &IPhreeqc::GetErrorOn, &IPhreeqc::SetErrorOn);
|
||||
if (testError.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Log
|
||||
TTestGetSet<IPhreeqc> testLog(&iphreeqc, &IPhreeqc::GetLogOn, &IPhreeqc::SetLogOn);
|
||||
if (testLog.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Output
|
||||
TTestGetSet<IPhreeqc> testOutput(&iphreeqc, &IPhreeqc::GetOutputOn, &IPhreeqc::SetOutputOn);
|
||||
if (testOutput.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Selected output
|
||||
TTestGetSet<IPhreeqc> testSelectedOutput(&iphreeqc, &IPhreeqc::GetSelectedOutputOn, &IPhreeqc::SetSelectedOutputOn);
|
||||
if (testSelectedOutput.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (iphreeqc.LoadDatabase("phreeqc.dat") != 0)
|
||||
{
|
||||
std::cout << iphreeqc.GetErrorString();
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (iphreeqc.RunFile("ex1") != 0)
|
||||
{
|
||||
std::cout << iphreeqc.GetErrorString();
|
||||
return 2;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user