mirror of
https://github.com/fwbuilder/fwbuilder
synced 2025-06-15 14:47:52 +02:00
test: FWException is not a subclass of std::exception
This commit is contained in:
parent
20ba0bccc8
commit
ac9e6296c8
@ -42,6 +42,7 @@
|
||||
#include "fwbuilder/Rule.h"
|
||||
#include "fwbuilder/TagService.h"
|
||||
#include "fwbuilder/Constants.h"
|
||||
#include "fwbuilder/FWException.h"
|
||||
|
||||
#include <QTest>
|
||||
#include <QDebug>
|
||||
@ -233,8 +234,8 @@ void ImporterTest::IOSImporterTest()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -263,8 +264,8 @@ void ImporterTest::IPTImporterTest()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -293,8 +294,8 @@ void ImporterTest::IPTImporterNoNatTest()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -334,8 +335,8 @@ void ImporterTest::IPTImporterParseVersionsTest()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "Inet6AddrMaskTest.h"
|
||||
#include <fwbuilder/Inet6AddrMask.h>
|
||||
#include <fwbuilder/uint128.h>
|
||||
#include "fwbuilder/FWException.h"
|
||||
|
||||
#include <QTest>
|
||||
|
||||
@ -136,8 +137,8 @@ void Inet6AddrMaskTest::testStringToInetAddrExceptions()
|
||||
|
||||
try {
|
||||
new InetAddr(AF_INET6, "fe80::20c:29ff:fed2:cca1/64");
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
QVERIFY_EXCEPTION_THROWN(new InetAddr(AF_INET6, "fe80::20c:29ff:fed2:cca1/200"), FWException);
|
||||
@ -146,8 +147,8 @@ void Inet6AddrMaskTest::testStringToInetAddrExceptions()
|
||||
|
||||
try {
|
||||
new InetAddr(AF_INET6, 64);
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
QVERIFY_EXCEPTION_THROWN(new InetAddr(AF_INET6, 256), FWException);
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
#include "InetAddrMaskTest.h"
|
||||
#include <fwbuilder/InetAddrMask.h>
|
||||
#include "fwbuilder/FWException.h"
|
||||
|
||||
#include <QTest>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
@ -107,14 +109,14 @@ void InetAddrMaskTest::testStringToInetAddrExceptions()
|
||||
{
|
||||
try {
|
||||
new InetAddr("1.2.3.4");
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
try {
|
||||
new InetAddr("1.2.3.4/24");
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
QVERIFY_EXCEPTION_THROWN(new InetAddr("1.2.3.4/40"), FWException);
|
||||
@ -127,16 +129,16 @@ void InetAddrMaskTest::testStringToInetAddrExceptions()
|
||||
QVERIFY_EXCEPTION_THROWN(new InetAddr(40), FWException);
|
||||
try {
|
||||
new InetAddr(24);
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
QVERIFY_EXCEPTION_THROWN(new InetAddr((char*)(nullptr)), FWException);
|
||||
|
||||
try {
|
||||
new InetAddr(0);
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "fwbuilder/Rule.h"
|
||||
#include "fwbuilder/TagService.h"
|
||||
#include "fwbuilder/Constants.h"
|
||||
#include "fwbuilder/FWException.h"
|
||||
|
||||
#include <QTest>
|
||||
#include <QDebug>
|
||||
@ -216,8 +217,8 @@ void PFImporterTest::macrosTest()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -241,8 +242,8 @@ void PFImporterTest::hostsMatchTest()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -269,8 +270,8 @@ void PFImporterTest::blockReturnTest()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -297,8 +298,8 @@ void PFImporterTest::icmpMatchTest()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -325,8 +326,8 @@ void PFImporterTest::interfaceMatchTest()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -353,8 +354,8 @@ void PFImporterTest::portMatchTest()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -381,8 +382,8 @@ void PFImporterTest::setCommandsTest()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -409,8 +410,8 @@ void PFImporterTest::stateMatchTest()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -437,8 +438,8 @@ void PFImporterTest::tcpFlagsMatchTest()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -465,8 +466,8 @@ void PFImporterTest::natCommands()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -493,8 +494,8 @@ void PFImporterTest::rdrCommands()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -521,8 +522,8 @@ void PFImporterTest::setTimeoutCommands()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -547,8 +548,8 @@ void PFImporterTest::scrubCommandsOld()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -570,8 +571,8 @@ void PFImporterTest::scrubCommandsNew()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -593,8 +594,8 @@ void PFImporterTest::tableDefinitions()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -619,8 +620,8 @@ void PFImporterTest::userGroupMatches()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -647,8 +648,8 @@ void PFImporterTest::routeToTest()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -672,8 +673,8 @@ void PFImporterTest::routeTo47Test()
|
||||
|
||||
try {
|
||||
imp->run() ;
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "fwbuilder/Rule.h"
|
||||
#include "fwbuilder/TagService.h"
|
||||
#include "fwbuilder/Constants.h"
|
||||
#include "fwbuilder/FWException.h"
|
||||
|
||||
#include <QTest>
|
||||
#include <QDebug>
|
||||
@ -215,8 +216,8 @@ void PIXImporterTest::PIX_6_Test()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -239,8 +240,8 @@ void PIXImporterTest::PIX_7_Test()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -263,8 +264,8 @@ void PIXImporterTest::PIX_7_NAT_Test()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -287,8 +288,8 @@ void PIXImporterTest::ASA_8_0_Test()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -311,8 +312,8 @@ void PIXImporterTest::ASA_8_3_Test()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -335,8 +336,8 @@ void PIXImporterTest::ObjectsAndGroupsTest()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -362,8 +363,8 @@ void PIXImporterTest::ACLObjectsAndGroupsTest()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -389,8 +390,8 @@ void PIXImporterTest::ACLTest()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -413,8 +414,8 @@ void PIXImporterTest::NamesTest()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
@ -435,8 +436,8 @@ void PIXImporterTest::FWSM_4_1_Test()
|
||||
|
||||
try {
|
||||
imp->run();
|
||||
} catch (const std::exception &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.what()).data());
|
||||
} catch (const FWException &e) {
|
||||
QFAIL(std::string("Exception thrown: ").append(e.toString()).data());
|
||||
}
|
||||
|
||||
imp->finalize();
|
||||
|
Loading…
x
Reference in New Issue
Block a user