Commit 0d02aac3 authored by Pavel Vainerman's avatar Pavel Vainerman Committed by Pavel Vainerman

used catch2 instead catch

parent e2aa43c8
......@@ -25,7 +25,7 @@
%define oname uniset2
Name: libuniset2
Version: 2.17.1
Version: 2.17.2
Release: alt1
Summary: UniSet - library for building distributed industrial control systems
......@@ -91,7 +91,7 @@ BuildRequires: doxygen graphviz ImageMagick-tools
%endif
%if_enabled tests
BuildRequires: catch
BuildRequires: catch2-devel
%endif
#set_verify_elf_method textrel=strict,rpath=strict,unresolved=strict
......@@ -594,6 +594,9 @@ rm -f %buildroot%_docdir/%oname/html/*.md5
# history of current unpublished changes
%changelog
* Sun Oct 31 2021 Pavel Vainerman <pv@altlinux.ru> 2.17.2-alt1
- used catch2 instead catch
* Thu Oct 28 2021 Pavel Vainerman <pv@altlinux.ru> 2.17.1-alt1
- DBServer-PGSQL: new libpqxx (c++17)
......
......@@ -3,10 +3,10 @@
# See doc: http://www.gnu.org/software/hello/manual/autoconf/Generic-Programs.html
# AC_PREREQ(2.59)
AC_INIT([uniset2], [2.17.1], pv@etersoft.ru)
AC_INIT([uniset2], [2.17.2], pv@etersoft.ru)
AM_INIT_AUTOMAKE([subdir-objects])
LIBVER=18:2:17
LIBVER=19:2:17
AC_SUBST(LIBVER)
# AC_CONFIG_MACRO_DIR([m4])
......
......@@ -18,14 +18,14 @@ int main( int argc, const char* argv[] )
if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) )
{
session.showHelp("tests_httpresolver");
session.showHelp();
return 0;
}
int returnCode = session.applyCommandLine( argc, argv, Catch::Session::OnUnusedOptions::Ignore );
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv);
......
......@@ -47,7 +47,7 @@ TEST_CASE("HttpResolver: resolve", "[httpresolver][ui]")
REQUIRE_NOTHROW( ui->resolve(TestProc, Node1) );
REQUIRE_NOTHROW( ui->resolve("UNISET_PLC/UniObjects/TestProc") );
REQUIRE_THROWS_AS( ui->resolve(DefaultObjectId, Node1), uniset::ResolveNameError& );
REQUIRE_THROWS_AS( ui->resolve(DefaultObjectId, Node1), uniset::ResolveNameError );
REQUIRE( ui->isExist(TestProc, Node1) );
}
// -----------------------------------------------------------------------------
......
......@@ -34,8 +34,8 @@ int main( int argc, const char* argv[] )
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv);
// dlog()->logFile("./smtest.log");
......
......@@ -26,8 +26,8 @@ int main(int argc, const char* argv[] )
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv, "lp-configure.xml");
......
......@@ -28,14 +28,14 @@ int main( int argc, const char* argv[] )
cout << "--confile - Использовать указанный конф. файл. По умолчанию configure.xml" << endl;
SharedMemory::help_print(argc, argv);
cout << endl << endl << "--------------- CATCH HELP --------------" << endl;
session.showHelp("tests_mbtcpmaster");
session.showHelp();
return 0;
}
int returnCode = session.applyCommandLine( argc, argv, Catch::Session::OnUnusedOptions::Ignore );
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv);
dlog()->logFile("./smtest.log");
......
......@@ -26,14 +26,14 @@ int main(int argc, const char* argv[] )
cout << "--confile - Использовать указанный конф. файл. По умолчанию configure.xml" << endl;
SharedMemory::help_print(argc, argv);
cout << endl << endl << "--------------- CATCH HELP --------------" << endl;
session.showHelp("test_mbtcpmultimaster");
session.showHelp();
return 0;
}
int returnCode = session.applyCommandLine( argc, argv, Catch::Session::OnUnusedOptions::Ignore );
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv);
dlog()->logFile("./smtest.log");
......
......@@ -24,14 +24,14 @@ int main(int argc, const char* argv[] )
cout << "--confile - Использовать указанный конф. файл. По умолчанию configure.xml" << endl;
SharedMemory::help_print(argc, argv);
cout << endl << endl << "--------------- CATCH HELP --------------" << endl;
session.showHelp("test_with_sm");
session.showHelp();
return 0;
}
int returnCode = session.applyCommandLine( argc, argv, Catch::Session::OnUnusedOptions::Ignore );
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv);
......
......@@ -33,8 +33,8 @@ int main(int argc, const char* argv[] )
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv);
......
......@@ -30,8 +30,8 @@ int main(int argc, char* argv[] )
int returnCode = session.applyCommandLine( argc, argv, Catch::Session::OnUnusedOptions::Ignore );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
uniset_init(argc, argv);
......
......@@ -30,8 +30,8 @@ int main(int argc, const char* argv[] )
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv);
......
......@@ -30,8 +30,8 @@ int main(int argc, const char* argv[] )
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv);
......
......@@ -24,14 +24,14 @@ int main(int argc, const char* argv[] )
cout << "--confile - Использовать указанный конф. файл. По умолчанию configure.xml" << endl;
SharedMemory::help_print(argc, argv);
cout << endl << endl << "--------------- CATCH HELP --------------" << endl;
session.showHelp("test_with_sm");
session.showHelp();
return 0;
}
int returnCode = session.applyCommandLine( argc, argv, Catch::Session::OnUnusedOptions::Ignore );
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv);
......
......@@ -287,9 +287,13 @@ namespace uniset
return raw;
}
// ------------------------------------------
operator int()
bool operator==(const int& a) const
{
return raw;
return (int)raw == a;
}
bool operator==(const long& a) const
{
return (long)raw == a;
}
uint16_t raw;
......@@ -330,9 +334,14 @@ namespace uniset
{
return raw;
}
operator int()
// ------------------------------------------
bool operator== (const int& a) const
{
return raw;
return (int)raw == a;
}
bool operator== (const long& a) const
{
return (long)raw == a;
}
int16_t raw;
......
......@@ -47,14 +47,14 @@ TEST_CASE("UInterface", "[UInterface]")
SECTION( "GET/SET" )
{
REQUIRE_THROWS_AS( ui->getValue(DefaultObjectId), uniset::ORepFailed& );
REQUIRE_THROWS_AS( ui->getValue(DefaultObjectId), uniset::ORepFailed );
REQUIRE_NOTHROW( ui->setValue(sid, 1) );
REQUIRE( ui->getValue(sid) == 1 );
REQUIRE_NOTHROW( ui->setValue(sid, 100) );
REQUIRE( ui->getValue(sid) == 100 ); // хоть это и дискретный датчик.. функция-то универсальная..
REQUIRE_THROWS_AS( ui->getValue(sid, DefaultObjectId), uniset::Exception& );
REQUIRE_THROWS_AS( ui->getValue(sid, 100), uniset::Exception& );
REQUIRE_THROWS_AS( ui->getValue(sid, DefaultObjectId), uniset::Exception );
REQUIRE_THROWS_AS( ui->getValue(sid, 100), uniset::Exception );
REQUIRE_NOTHROW( ui->setValue(aid, 10) );
REQUIRE( ui->getValue(aid) == 10 );
......@@ -67,16 +67,16 @@ TEST_CASE("UInterface", "[UInterface]")
REQUIRE_NOTHROW( ui->fastSetValue(si, 20, DefaultObjectId) );
REQUIRE( ui->getValue(aid) == 20 );
REQUIRE_THROWS_AS( ui->getValue(aid, -2), uniset::Exception& );
REQUIRE_THROWS_AS( ui->getValue(aid, -2), uniset::Exception );
si.id = sid;
REQUIRE_NOTHROW( ui->setValue(si, 15, DefaultObjectId) );
REQUIRE( ui->getValue(sid) == 15 );
si.node = -2;
REQUIRE_THROWS_AS( ui->setValue(si, 20, DefaultObjectId), uniset::Exception& );
REQUIRE_THROWS_AS( ui->setValue(si, 20, DefaultObjectId), uniset::Exception );
REQUIRE_THROWS_AS( ui->getTimeChange(sid, DefaultObjectId), uniset::ORepFailed& );
REQUIRE_THROWS_AS( ui->getTimeChange(sid, DefaultObjectId), uniset::ORepFailed );
REQUIRE_NOTHROW( ui->getTimeChange(sid, conf->getLocalNode()) );
si.id = aid;
......@@ -96,8 +96,8 @@ TEST_CASE("UInterface", "[UInterface]")
SECTION( "resolve" )
{
REQUIRE_NOTHROW( ui->resolve(sid) );
REQUIRE_THROWS_AS( ui->resolve(sid, 10), uniset::ResolveNameError& );
REQUIRE_THROWS_AS( ui->resolve(sid, DefaultObjectId), uniset::ResolveNameError& );
REQUIRE_THROWS_AS( ui->resolve(sid, 10), uniset::ResolveNameError );
REQUIRE_THROWS_AS( ui->resolve(sid, DefaultObjectId), uniset::ResolveNameError );
REQUIRE_NOTHROW( ui->resolve("UNISET_PLC/Controllers/SharedMemory") );
}
......@@ -164,17 +164,17 @@ TEST_CASE("UInterface", "[UInterface]")
SECTION( "ask" )
{
REQUIRE_THROWS_AS( ui->askSensor(sid, UniversalIO::UIONotify), uniset::IOBadParam& );
REQUIRE_THROWS_AS( ui->askSensor(sid, UniversalIO::UIONotify), uniset::IOBadParam );
REQUIRE_NOTHROW( ui->askSensor(sid, UniversalIO::UIONotify, testOID) );
REQUIRE_NOTHROW( ui->askSensor(aid, UniversalIO::UIONotify, testOID) );
REQUIRE_NOTHROW( ui->askSensor(aid, UniversalIO::UIODontNotify, testOID) );
REQUIRE_NOTHROW( ui->askSensor(sid, UniversalIO::UIODontNotify, testOID) );
REQUIRE_THROWS_AS( ui->askSensor(-20, UniversalIO::UIONotify), uniset::Exception& );
REQUIRE_THROWS_AS( ui->askSensor(-20, UniversalIO::UIONotify), uniset::Exception );
REQUIRE_NOTHROW( ui->askRemoteSensor(sid, UniversalIO::UIONotify, conf->getLocalNode(), testOID) );
REQUIRE_NOTHROW( ui->askRemoteSensor(aid, UniversalIO::UIONotify, conf->getLocalNode(), testOID) );
REQUIRE_THROWS_AS( ui->askRemoteSensor(sid, UniversalIO::UIONotify, -3, testOID), uniset::Exception& );
REQUIRE_THROWS_AS( ui->askRemoteSensor(sid, UniversalIO::UIONotify, -3, testOID), uniset::Exception );
uniset::IDList lst;
lst.add(aid);
......@@ -190,7 +190,7 @@ TEST_CASE("UInterface", "[UInterface]")
REQUIRE_NOTHROW( ui->askThreshold(aid, 10, UniversalIO::UIONotify, 90, 100, false, testOID) );
REQUIRE_NOTHROW( ui->askThreshold(aid, 11, UniversalIO::UIONotify, 50, 70, false, testOID) );
REQUIRE_NOTHROW( ui->askThreshold(aid, 12, UniversalIO::UIONotify, 20, 40, false, testOID) );
REQUIRE_THROWS_AS( ui->askThreshold(aid, 3, UniversalIO::UIONotify, 50, 20, false, testOID), IONotifyController_i::BadRange& );
REQUIRE_THROWS_AS( ui->askThreshold(aid, 3, UniversalIO::UIONotify, 50, 20, false, testOID), IONotifyController_i::BadRange );
IONotifyController_i::ThresholdsListSeq_var slist = ui->getThresholdsList(aid);
REQUIRE( slist->length() == 1 ); // количество датчиков с порогами = 1 (это aid)
......@@ -213,7 +213,7 @@ TEST_CASE("UInterface", "[UInterface]")
REQUIRE( ti3.lowlimit == 20 );
REQUIRE( ti3.hilimit == 40 );
REQUIRE_THROWS_AS( ui->getThresholdInfo(sid, 10), uniset::NameNotFound& );
REQUIRE_THROWS_AS( ui->getThresholdInfo(sid, 10), uniset::NameNotFound );
// проверяем thresholds который был сформирован из секции <thresholds>
ui->setValue(10, 378);
......
......@@ -325,7 +325,7 @@ TEST_CASE("VTypes: Signed", "[vtypes][signed]")
{
ModbusRTU::ModbusData d = 65535;
Signed v(d);
REQUIRE( (int)v == (int)d );
REQUIRE( (ModbusRTU::ModbusData)v == d );
}
}
// -----------------------------------------------------------------------------
......@@ -12,10 +12,10 @@ int main( int argc, const char* argv[] )
uniset::uniset_init(argc, argv);
int returnCode = session.applyCommandLine( argc, argv, Catch::Session::OnUnusedOptions::Ignore );
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
return session.run();
}
......
......@@ -60,8 +60,8 @@ int main(int argc, const char* argv[] )
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
auto conf = uniset_init(argc, argv);
......
......@@ -15,8 +15,8 @@ int main( int argc, const char* argv[] )
int returnCode = session.applyCommandLine( argc, argv );
if( returnCode != 0 ) // Indicates a command line error
return returnCode;
// if( returnCode != 0 ) // Indicates a command line error
// return returnCode;
return session.run();
}
......
......@@ -217,7 +217,7 @@ class ShortIOInfo(_object):
ShortIOInfo_swigregister = _UniSet.ShortIOInfo_swigregister
ShortIOInfo_swigregister(ShortIOInfo)
class UException(BaseException, _object):
class UException(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, UException, name, value)
__swig_getmethods__ = {}
......@@ -225,7 +225,6 @@ class UException(BaseException, _object):
__repr__ = _swig_repr
def __init__(self, *args):
BaseException.__init__(self, args)
this = _UniSet.new_UException(*args)
try:
self.this.append(this)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment