mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-05-01 14:47:27 +02:00
test: Add unit tests to CMake
This commit is contained in:
parent
93510d5756
commit
638a117a5f
@ -20,6 +20,7 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
"Choose the type of build, options are: Debug or Release."
|
||||
FORCE)
|
||||
endif()
|
||||
include( CTest )
|
||||
|
||||
### Dependencies
|
||||
|
||||
@ -107,6 +108,7 @@ add_subdirectory(src/libfwbuilder/etc)
|
||||
add_subdirectory(src/libfwbuilder/migration)
|
||||
add_subdirectory(src/res)
|
||||
add_subdirectory(doc)
|
||||
add_subdirectory(src/unit_tests)
|
||||
|
||||
### Packaging
|
||||
add_subdirectory(packaging)
|
||||
|
||||
48
cmake/FindCppUnit.cmake
Normal file
48
cmake/FindCppUnit.cmake
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
# Find the CppUnit includes and library
|
||||
#
|
||||
# This module defines
|
||||
# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
|
||||
# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
|
||||
# CPPUNIT_FOUND, If false, do not try to use CppUnit.
|
||||
|
||||
# also defined, but not for general use are
|
||||
# CPPUNIT_LIBRARY, where to find the CppUnit library.
|
||||
# CPPUNIT_DEBUG_LIBRARY, where to find the CppUnit library in debug mode.
|
||||
|
||||
FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h HINTS
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
ENV CppUnit_ROOT
|
||||
)
|
||||
|
||||
# With Win32, important to have both
|
||||
IF(WIN32)
|
||||
FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
|
||||
${CPPUNIT_INCLUDE_DIR}/../lib
|
||||
/usr/local/lib
|
||||
/usr/lib)
|
||||
FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunitd
|
||||
${CPPUNIT_INCLUDE_DIR}/../lib
|
||||
/usr/local/lib
|
||||
/usr/lib)
|
||||
ELSE(WIN32)
|
||||
# On unix system, debug and release have the same name
|
||||
FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
|
||||
${CPPUNIT_INCLUDE_DIR}/../lib
|
||||
/usr/local/lib
|
||||
/usr/lib)
|
||||
FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunit
|
||||
${CPPUNIT_INCLUDE_DIR}/../lib
|
||||
/usr/local/lib
|
||||
/usr/lib)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(CPPUNIT_INCLUDE_DIR)
|
||||
IF(CPPUNIT_LIBRARY)
|
||||
SET(CPPUNIT_FOUND "YES")
|
||||
SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS})
|
||||
SET(CPPUNIT_DEBUG_LIBRARIES ${CPPUNIT_DEBUG_LIBRARY}
|
||||
${CMAKE_DL_LIBS})
|
||||
ENDIF(CPPUNIT_LIBRARY)
|
||||
ENDIF(CPPUNIT_INCLUDE_DIR)
|
||||
6
src/unit_tests/AddressRangeDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/AddressRangeDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(AddressRangeDialogTest AddressRangeDialogTest.cpp main_AddressRangeDialogTest.cpp)
|
||||
add_test(NAME AddressRangeDialogTest COMMAND AddressRangeDialogTest)
|
||||
|
||||
target_link_libraries(AddressRangeDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -41,7 +41,6 @@ FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
9
src/unit_tests/AddressTableTest/CMakeLists.txt
Normal file
9
src/unit_tests/AddressTableTest/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(AddressTableTest AddressTableTest.cpp main.cpp)
|
||||
add_test(NAME AddressTableTest COMMAND AddressTableTest)
|
||||
|
||||
target_link_libraries(AddressTableTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY addresstable-1.txt addresstable-2.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
55
src/unit_tests/CMakeLists.txt
Normal file
55
src/unit_tests/CMakeLists.txt
Normal file
@ -0,0 +1,55 @@
|
||||
include( CTest )
|
||||
|
||||
find_package(CppUnit REQUIRED)
|
||||
find_package(Qt5Test REQUIRED)
|
||||
|
||||
enable_testing(TRUE)
|
||||
|
||||
add_subdirectory(main)
|
||||
|
||||
add_subdirectory(AddressRangeDialogTest)
|
||||
add_subdirectory(AddressTableTest)
|
||||
add_subdirectory(commandLinePrintingTest)
|
||||
add_subdirectory(compilerLibTest)
|
||||
add_subdirectory(CustomServiceDialogTest)
|
||||
add_subdirectory(DNSTest)
|
||||
add_subdirectory(FirewallDialogTest)
|
||||
add_subdirectory(FWBTreeTest)
|
||||
add_subdirectory(FWObjectTest)
|
||||
add_subdirectory(FWWindowTest)
|
||||
add_subdirectory(generatedScriptTestsIpfilter)
|
||||
add_subdirectory(generatedScriptTestsIpfw)
|
||||
add_subdirectory(generatedScriptTestsLinux)
|
||||
add_subdirectory(generatedScriptTestsPF)
|
||||
add_subdirectory(generatedScriptTestsSecuwall)
|
||||
add_subdirectory(genericDialogTest)
|
||||
add_subdirectory(GroupObjectDialogTest)
|
||||
add_subdirectory(ICMP6ServiceDialogTest)
|
||||
add_subdirectory(ICMPServiceDialogTest)
|
||||
add_subdirectory(ImporterTest)
|
||||
add_subdirectory(Inet6AddrMaskTest)
|
||||
add_subdirectory(InetAddrMaskTest)
|
||||
add_subdirectory(instDialogClusterTest)
|
||||
add_subdirectory(instDialogCompileTest)
|
||||
add_subdirectory(instDialogInspectTest)
|
||||
add_subdirectory(instDialogInstallTest)
|
||||
add_subdirectory(instDialogObjectListTest)
|
||||
add_subdirectory(InterfaceDialogTest)
|
||||
add_subdirectory(IPDialogTest)
|
||||
add_subdirectory(IPServiceDialogTest)
|
||||
add_subdirectory(NetworkDialogTest)
|
||||
add_subdirectory(newClusterDialogTest)
|
||||
add_subdirectory(ObjectManipulatorTest)
|
||||
add_subdirectory(ObjectMatcherTest)
|
||||
add_subdirectory(parseCommandLineTest)
|
||||
add_subdirectory(PFImporterTest)
|
||||
add_subdirectory(PIXImporterTest)
|
||||
add_subdirectory(RCS)
|
||||
add_subdirectory(RuleSetViewContextMenuTest)
|
||||
add_subdirectory(RuleSetViewTest)
|
||||
add_subdirectory(startTipDialogTest)
|
||||
add_subdirectory(TagServiceDialogTest)
|
||||
add_subdirectory(TCPServiceDialogTest)
|
||||
add_subdirectory(UDPServiceDialogTest)
|
||||
add_subdirectory(UsageResolverTest)
|
||||
add_subdirectory(UserSerivceDialogTest)
|
||||
6
src/unit_tests/CustomServiceDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/CustomServiceDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(CustomServiceDialogTest CustomServiceDialogTest.cpp main_CustomServiceDialogTest.cpp)
|
||||
add_test(NAME CustomServiceDialogTest COMMAND CustomServiceDialogTest)
|
||||
|
||||
target_link_libraries(CustomServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
4
src/unit_tests/DNSTest/CMakeLists.txt
Normal file
4
src/unit_tests/DNSTest/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_executable(DNSTest DNSTest.cpp main.cpp)
|
||||
add_test(NAME DNSTest COMMAND DNSTest)
|
||||
|
||||
target_link_libraries(DNSTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
4
src/unit_tests/FWBTreeTest/CMakeLists.txt
Normal file
4
src/unit_tests/FWBTreeTest/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_executable(FWBTreeTest FWBTreeTest.cpp main_FWBTreeTest.cpp)
|
||||
add_test(NAME FWBTreeTest COMMAND FWBTreeTest)
|
||||
|
||||
target_link_libraries(FWBTreeTest PRIVATE gui fwbuilder xml2 xslt z cppunit)
|
||||
4
src/unit_tests/FWObjectTest/CMakeLists.txt
Normal file
4
src/unit_tests/FWObjectTest/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_executable(FWObjectTest FWObjectTest.cpp main.cpp)
|
||||
add_test(NAME FWObjectTest COMMAND FWObjectTest)
|
||||
|
||||
target_link_libraries(FWObjectTest PRIVATE fwbuilder xml2 xslt z cppunit)
|
||||
8
src/unit_tests/FWWindowTest/CMakeLists.txt
Normal file
8
src/unit_tests/FWWindowTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(FWWindowTest FWWindowTest.cpp main_FWWindowTest.cpp)
|
||||
add_test(NAME FWWindowTest COMMAND FWWindowTest)
|
||||
|
||||
target_link_libraries(FWWindowTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
#target_link_libraries(fwb_ipt common iptlib compilerdriver fwcompiler fwbuilder xml2 pthread m xslt z)
|
||||
#target_link_libraries(fwbuilder-gui gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 m xslt z OpenSSL::Crypto pthread)
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/FirewallDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/FirewallDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(FirewallDialogTest FirewallDialogTest.cpp main_FirewallDialogTest.cpp)
|
||||
add_test(NAME FirewallDialogTest COMMAND FirewallDialogTest)
|
||||
|
||||
target_link_libraries(FirewallDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/GroupObjectDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/GroupObjectDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(GroupObjectDialogTest GroupObjectDialogTest.cpp main_GroupObjectDialogTest.cpp)
|
||||
add_test(NAME GroupObjectDialogTest COMMAND GroupObjectDialogTest)
|
||||
|
||||
target_link_libraries(GroupObjectDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/ICMP6ServiceDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/ICMP6ServiceDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(ICMP6ServiceDialogTest ICMP6ServiceDialogTest.cpp main_ICMP6ServiceDialogTest.cpp)
|
||||
add_test(NAME ICMP6ServiceDialogTest COMMAND ICMP6ServiceDialogTest)
|
||||
|
||||
target_link_libraries(ICMP6ServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/ICMPServiceDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/ICMPServiceDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(ICMPServiceDialogTest ICMPServiceDialogTest.cpp main_ICMPServiceDialogTest.cpp)
|
||||
add_test(NAME ICMPServiceDialogTest COMMAND ICMPServiceDialogTest)
|
||||
|
||||
target_link_libraries(ICMPServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/IPDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/IPDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(IPDialogTest IPDialogTest.cpp main_IPDialogTest.cpp)
|
||||
add_test(NAME IPDialogTest COMMAND IPDialogTest)
|
||||
|
||||
target_link_libraries(IPDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -40,7 +40,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/IPServiceDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/IPServiceDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(IPServiceDialogTest IPServiceDialogTest.cpp main_IPServiceDialogTest.cpp)
|
||||
add_test(NAME IPServiceDialogTest COMMAND IPServiceDialogTest)
|
||||
|
||||
target_link_libraries(IPServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -40,7 +40,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
8
src/unit_tests/ImporterTest/CMakeLists.txt
Normal file
8
src/unit_tests/ImporterTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
add_executable(ImporterTest ImporterTest.cpp main_ImporterTest.cpp)
|
||||
add_test(NAME ImporterTest COMMAND ImporterTest)
|
||||
|
||||
target_link_libraries(ImporterTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY test_data DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||
@ -36,14 +36,13 @@
|
||||
#include <QString>
|
||||
#include <string>
|
||||
|
||||
#include "../../../common/init.cpp"
|
||||
#include "common/init.cpp"
|
||||
|
||||
int fwbdebug = 0;
|
||||
//QString user_name;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
std::string platform;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
||||
4
src/unit_tests/Inet6AddrMaskTest/CMakeLists.txt
Normal file
4
src/unit_tests/Inet6AddrMaskTest/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_executable(Inet6AddrMaskTest Inet6AddrMaskTest.cpp main.cpp)
|
||||
add_test(NAME Inet6AddrMaskTest COMMAND Inet6AddrMaskTest)
|
||||
|
||||
target_link_libraries(Inet6AddrMaskTest PRIVATE fwbuilder xml2 xslt z cppunit)
|
||||
4
src/unit_tests/InetAddrMaskTest/CMakeLists.txt
Normal file
4
src/unit_tests/InetAddrMaskTest/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_executable(InetAddrMaskTest InetAddrMaskTest.cpp main.cpp)
|
||||
add_test(NAME InetAddrMaskTest COMMAND InetAddrMaskTest)
|
||||
|
||||
target_link_libraries(InetAddrMaskTest PRIVATE fwbuilder xml2 xslt z cppunit)
|
||||
6
src/unit_tests/InterfaceDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/InterfaceDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(InterfaceDialogTest InterfaceDialogTest.cpp main_InterfaceDialogTest.cpp)
|
||||
add_test(NAME InterfaceDialogTest COMMAND InterfaceDialogTest)
|
||||
|
||||
target_link_libraries(InterfaceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -40,7 +40,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/NetworkDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/NetworkDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(NetworkDialogTest NetworkDialogTest.cpp main_NetworkDialogTest.cpp)
|
||||
add_test(NAME NetworkDialogTest COMMAND NetworkDialogTest)
|
||||
|
||||
target_link_libraries(NetworkDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -40,7 +40,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
8
src/unit_tests/ObjectManipulatorTest/CMakeLists.txt
Normal file
8
src/unit_tests/ObjectManipulatorTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(ObjectManipulatorTest ObjectManipulatorTest.cpp main_ObjectManipulatorTest.cpp)
|
||||
add_test(NAME ObjectManipulatorTest COMMAND ObjectManipulatorTest)
|
||||
|
||||
target_link_libraries(ObjectManipulatorTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
|
||||
file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
@ -56,6 +55,7 @@ int main(int argc, char** argv)
|
||||
|
||||
build_app(argc, argv, &app, &st);
|
||||
|
||||
QFile::copy("test.fwb", "test_work.fwb");
|
||||
|
||||
QTest::qExec(new ObjectManipulatorTest());
|
||||
|
||||
|
||||
6
src/unit_tests/ObjectMatcherTest/CMakeLists.txt
Normal file
6
src/unit_tests/ObjectMatcherTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
add_executable(ObjectMatcherTest ObjectMatcherTest.cpp main.cpp)
|
||||
add_test(NAME ObjectMatcherTest COMMAND ObjectMatcherTest)
|
||||
|
||||
target_link_libraries(ObjectMatcherTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY test_data.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@ -130,35 +130,35 @@ void ObjectMatcherTest::matchTest()
|
||||
CPPUNIT_ASSERT(om.dispatch(host1_eth0, fw1));
|
||||
CPPUNIT_ASSERT(om.dispatch(host1, fw1));
|
||||
|
||||
CPPUNIT_ASSERT(om.dispatch(host2_eth0_ip, fw1) == false);
|
||||
CPPUNIT_ASSERT(om.dispatch(host2_eth0, fw1) == false);
|
||||
CPPUNIT_ASSERT(om.dispatch(host2, fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(host2_eth0_ip, fw1)) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(host2_eth0, fw1)) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(host2, fw1)) == false);
|
||||
|
||||
om.setMatchSubnets(true);
|
||||
CPPUNIT_ASSERT(om.dispatch(host2_eth0_ip, fw1));
|
||||
|
||||
om.setMatchSubnets(false);
|
||||
|
||||
CPPUNIT_ASSERT(om.dispatch(host3_eth0, fw1) == false);
|
||||
CPPUNIT_ASSERT(om.dispatch(host3_eth1, fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(host3_eth0, fw1)) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(host3_eth1, fw1)) == false);
|
||||
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1));
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1_eth1));
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1_eth0) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1_eth0)) == false);
|
||||
|
||||
om.setIPV6(true);
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv6::cast(o("addr-ipv6-1")), fw1));
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv6::cast(o("addr-ipv6-2")), fw1) == false);
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(IPv6::cast(o("addr-ipv6-2")), fw1)) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1)) == false);
|
||||
|
||||
om.setIPV6(false);
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv6::cast(o("addr-ipv6-1")), fw1) == false);
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv6::cast(o("addr-ipv6-2")), fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(IPv6::cast(o("addr-ipv6-1")), fw1)) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(IPv6::cast(o("addr-ipv6-2")), fw1)) == false);
|
||||
|
||||
|
||||
CPPUNIT_ASSERT(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1) == false);
|
||||
CPPUNIT_ASSERT(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1_eth1) == false);
|
||||
CPPUNIT_ASSERT(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1_eth0) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1)) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1_eth1)) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1_eth0)) == false);
|
||||
CPPUNIT_ASSERT(om.dispatch(Network::cast(o("net-192.168.1.1")), fw1));
|
||||
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.255")), fw1));
|
||||
@ -166,8 +166,8 @@ void ObjectMatcherTest::matchTest()
|
||||
CPPUNIT_ASSERT(om.dispatch(Network::cast(o("all multicasts")), fw1));
|
||||
|
||||
om.setRecognizeBroadcasts(false);
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.255")), fw1) == false);
|
||||
CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.0")), fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(IPv4::cast(o("addr-192.168.1.255")), fw1)) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(IPv4::cast(o("addr-192.168.1.0")), fw1)) == false);
|
||||
|
||||
// ================================================================
|
||||
// AddressRange tests
|
||||
@ -175,16 +175,16 @@ void ObjectMatcherTest::matchTest()
|
||||
|
||||
// range1 192.168.1.10 - 192.168.1.20
|
||||
// does not match fw1 exactly, but matches when match_subnets == true
|
||||
CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range1")), fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(AddressRange::cast(o("range1")), fw1)) == false);
|
||||
|
||||
// range2 192.168.2.1-192.168.2.3 does not match fw1:eth2 at all
|
||||
CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range2")), fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(AddressRange::cast(o("range2")), fw1)) == false);
|
||||
|
||||
// range3 192.168.2.27-192.168.2.50 partially overlaps with fw1:eth2 subnet
|
||||
CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range3")), fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(AddressRange::cast(o("range3")), fw1)) == false);
|
||||
|
||||
// range4 192.168.2.27-192.168.2.30 is completely inside fw1:eth2 subnet
|
||||
CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range4")), fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(AddressRange::cast(o("range4")), fw1)) == false);
|
||||
|
||||
// ================================================================
|
||||
om.setAddressRangeMatchMode(ObjectMatcher::PARTIAL);
|
||||
@ -195,10 +195,10 @@ void ObjectMatcherTest::matchTest()
|
||||
|
||||
// range3 192.168.2.27-192.168.2.50 partially overlaps with fw1:eth2 subnet
|
||||
// but address of interface 192.168.2.24 is outside the range
|
||||
CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range3")), fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(AddressRange::cast(o("range3")), fw1)) == false);
|
||||
|
||||
// range4 192.168.2.27-192.168.2.30 is completely inside fw1:eth2 subnet
|
||||
CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range4")), fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(AddressRange::cast(o("range4")), fw1)) == false);
|
||||
|
||||
// fw1:eth2:ip 192.168.2.24 falls inside range5
|
||||
CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range5")), fw1));
|
||||
@ -211,7 +211,7 @@ void ObjectMatcherTest::matchTest()
|
||||
CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range1")), fw1));
|
||||
|
||||
// range2 192.168.2.1-192.168.2.3 does not match fw1:eth2 at all
|
||||
CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range2")), fw1) == false);
|
||||
CPPUNIT_ASSERT(static_cast<bool>(om.dispatch(AddressRange::cast(o("range2")), fw1)) == false);
|
||||
|
||||
// range3 192.168.2.27-192.168.2.50 partially overlaps with fw1:eth2 subnet
|
||||
CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range3")), fw1));
|
||||
|
||||
8
src/unit_tests/PFImporterTest/CMakeLists.txt
Normal file
8
src/unit_tests/PFImporterTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
add_executable(PFImporterTest PFImporterTest.cpp main_PFImporterTest.cpp)
|
||||
add_test(NAME PFImporterTest COMMAND PFImporterTest)
|
||||
|
||||
target_link_libraries(PFImporterTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY test_data DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||
@ -34,14 +34,13 @@
|
||||
#include <QString>
|
||||
#include <string>
|
||||
|
||||
#include "../../../common/init.cpp"
|
||||
#include "common/init.cpp"
|
||||
|
||||
int fwbdebug = 0;
|
||||
//QString user_name;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
std::string platform;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
||||
8
src/unit_tests/PIXImporterTest/CMakeLists.txt
Normal file
8
src/unit_tests/PIXImporterTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
add_executable(PIXImporterTest PIXImporterTest.cpp main_PIXImporterTest.cpp)
|
||||
add_test(NAME PIXImporterTest COMMAND PIXImporterTest)
|
||||
|
||||
target_link_libraries(PIXImporterTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY test_data DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||
@ -39,6 +39,7 @@
|
||||
#include <QString>
|
||||
|
||||
|
||||
|
||||
class PIXImporterTest : public CppUnit::TestFixture
|
||||
{
|
||||
libfwbuilder::FWObjectDatabase *db;
|
||||
|
||||
@ -34,14 +34,13 @@
|
||||
#include <QString>
|
||||
#include <string>
|
||||
|
||||
#include "../../../common/init.cpp"
|
||||
#include "common/init.cpp"
|
||||
|
||||
int fwbdebug = 0;
|
||||
//QString user_name;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
std::string platform;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
||||
6
src/unit_tests/RCS/CMakeLists.txt
Normal file
6
src/unit_tests/RCS/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
add_executable(RCSTest RCSTest.cpp main_RCS.cpp)
|
||||
add_test(NAME RCSTest COMMAND RCSTest)
|
||||
|
||||
target_link_libraries(RCSTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY rlog_unit_test.log "zu.fwb,v" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
6
src/unit_tests/RuleSetViewContextMenuTest/CMakeLists.txt
Normal file
6
src/unit_tests/RuleSetViewContextMenuTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(RuleSetViewContextMenuTest RuleSetViewContextMenuTest.cpp main_RuleSetViewContextMenuTest.cpp)
|
||||
add_test(NAME RuleSetViewContextMenuTest COMMAND RuleSetViewContextMenuTest)
|
||||
|
||||
target_link_libraries(RuleSetViewContextMenuTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/RuleSetViewTest/CMakeLists.txt
Normal file
6
src/unit_tests/RuleSetViewTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(RuleSetViewTest RuleSetViewTest.cpp main_RuleSetViewTest.cpp)
|
||||
add_test(NAME RuleSetViewTest COMMAND RuleSetViewTest)
|
||||
|
||||
target_link_libraries(RuleSetViewTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/TCPServiceDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/TCPServiceDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(TCPServiceDialogTest TCPServiceDialogTest.cpp main_TCPServiceDialogTest.cpp)
|
||||
add_test(NAME TCPServiceDialogTest COMMAND TCPServiceDialogTest)
|
||||
|
||||
target_link_libraries(TCPServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -40,7 +40,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/TagServiceDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/TagServiceDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(TagServiceDialogTest TagServiceDialogTest.cpp main_TagServiceDialogTest.cpp)
|
||||
add_test(NAME TagServiceDialogTest COMMAND TagServiceDialogTest)
|
||||
|
||||
target_link_libraries(TagServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
6
src/unit_tests/UDPServiceDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/UDPServiceDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(UDPServiceDialogTest UDPServiceDialogTest.cpp main_UDPServiceDialogTest.cpp)
|
||||
add_test(NAME UDPServiceDialogTest COMMAND UDPServiceDialogTest)
|
||||
|
||||
target_link_libraries(UDPServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -40,7 +40,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
4
src/unit_tests/UsageResolverTest/CMakeLists.txt
Normal file
4
src/unit_tests/UsageResolverTest/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_executable(UsageResolverTest UsageResolverTest.cpp main_UsageResolverTest.cpp)
|
||||
add_test(NAME UsageResolverTest COMMAND UsageResolverTest)
|
||||
|
||||
target_link_libraries(UsageResolverTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
6
src/unit_tests/UserSerivceDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/UserSerivceDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(UserServiceDialogTest UserServiceDialogTest.cpp main_UserServiceDialogTest.cpp)
|
||||
add_test(NAME UserServiceDialogTest COMMAND UserServiceDialogTest)
|
||||
|
||||
target_link_libraries(UserServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -40,7 +40,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
4
src/unit_tests/commandLinePrintingTest/CMakeLists.txt
Normal file
4
src/unit_tests/commandLinePrintingTest/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_test(NAME commandLinePrintingTest COMMAND commandLinePrintingTest)
|
||||
|
||||
file(COPY commandLinePrintingTest test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
pushd "$( dirname "${BASH_SOURCE[0]}" )"
|
||||
|
||||
rm -f print.pdf >/dev/null 2>/dev/null
|
||||
|
||||
QTVERSION=$(${QMAKE:-qmake} --version 2>&1 | tail -n1| cut -d' ' -f4)
|
||||
|
||||
10
src/unit_tests/compilerLibTest/CMakeLists.txt
Normal file
10
src/unit_tests/compilerLibTest/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||
|
||||
add_executable(compilerLibTest interfacePropertiesTest.cpp tests_main.cpp)
|
||||
add_test(NAME compilerLibTest COMMAND compilerLibTest)
|
||||
|
||||
target_link_libraries(compilerLibTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@ -0,0 +1,8 @@
|
||||
add_executable(generatedScriptTestsIpfilter generatedScriptTestsIpfilter.cpp main_generatedScriptTestsIpfilter.cpp)
|
||||
add_test(NAME generatedScriptTestsIpfilter COMMAND generatedScriptTestsIpfilter)
|
||||
|
||||
target_link_libraries(generatedScriptTestsIpfilter PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY test1.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||
@ -35,7 +35,7 @@
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "../../../common/init.cpp"
|
||||
#include "common/init.cpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
8
src/unit_tests/generatedScriptTestsIpfw/CMakeLists.txt
Normal file
8
src/unit_tests/generatedScriptTestsIpfw/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
add_executable(generatedScriptTestsIpfw generatedScriptTestsIpfw.cpp main_generatedScriptTestsIpfw.cpp)
|
||||
add_test(NAME generatedScriptTestsIpfw COMMAND generatedScriptTestsIpfw)
|
||||
|
||||
target_link_libraries(generatedScriptTestsIpfw PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY test1.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||
@ -35,7 +35,7 @@
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "../../../common/init.cpp"
|
||||
#include "common/init.cpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
8
src/unit_tests/generatedScriptTestsLinux/CMakeLists.txt
Normal file
8
src/unit_tests/generatedScriptTestsLinux/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
add_executable(generatedScriptTestsLinux generatedScriptTestsLinux.cpp main_generatedScriptTestsLinux.cpp)
|
||||
add_test(NAME generatedScriptTestsLinux COMMAND generatedScriptTestsLinux)
|
||||
|
||||
target_link_libraries(generatedScriptTestsLinux PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY test1.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||
@ -35,7 +35,7 @@
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "../../../common/init.cpp"
|
||||
#include "common/init.cpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
8
src/unit_tests/generatedScriptTestsPF/CMakeLists.txt
Normal file
8
src/unit_tests/generatedScriptTestsPF/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
add_executable(generatedScriptTestsPF generatedScriptTestsPF.cpp main_generatedScriptTestsPF.cpp)
|
||||
add_test(NAME generatedScriptTestsPF COMMAND generatedScriptTestsPF)
|
||||
|
||||
target_link_libraries(generatedScriptTestsPF PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY test1.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||
@ -35,7 +35,7 @@
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "../../../common/init.cpp"
|
||||
#include "common/init.cpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
add_executable(generatedScriptTestsSecuwall generatedScriptTestsSecuwall.cpp main_generatedScriptTestsSecuwall.cpp)
|
||||
add_test(NAME generatedScriptTestsSecuwall COMMAND generatedScriptTestsSecuwall)
|
||||
|
||||
target_link_libraries(generatedScriptTestsSecuwall PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
|
||||
file(COPY test1.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||
@ -26,7 +26,7 @@
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "../../../common/init.cpp"
|
||||
#include "common/init.cpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
6
src/unit_tests/genericDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/genericDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(genericDialogTest genericDialogTest.cpp main_genericDialogTest.cpp)
|
||||
add_test(NAME genericDialogTest COMMAND genericDialogTest)
|
||||
|
||||
target_link_libraries(genericDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -39,6 +39,7 @@
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QRadioButton>
|
||||
#include <QButtonGroup>
|
||||
#include <QMessageBox>
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
8
src/unit_tests/instDialogClusterTest/CMakeLists.txt
Normal file
8
src/unit_tests/instDialogClusterTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(instDialogClusterTest instDialogClusterTest.cpp main_instDialogClusterTest.cpp)
|
||||
add_test(NAME instDialogClusterTest COMMAND instDialogClusterTest)
|
||||
|
||||
target_link_libraries(instDialogClusterTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
|
||||
file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
@ -56,6 +55,7 @@ int main(int argc, char** argv)
|
||||
|
||||
build_app(argc, argv, &app, &st);
|
||||
|
||||
QFile::copy("test.fwb", "test_work.fwb");
|
||||
|
||||
QTest::qExec(new instDialogClusterTest());
|
||||
|
||||
|
||||
8
src/unit_tests/instDialogCompileTest/CMakeLists.txt
Normal file
8
src/unit_tests/instDialogCompileTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(instDialogCompileTest instDialogCompileTest.cpp main_instDialogCompileTest.cpp)
|
||||
add_test(NAME instDialogCompileTest COMMAND instDialogCompileTest)
|
||||
|
||||
target_link_libraries(instDialogCompileTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
|
||||
file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
@ -56,6 +55,7 @@ int main(int argc, char** argv)
|
||||
|
||||
build_app(argc, argv, &app, &st);
|
||||
|
||||
QFile::copy("test.fwb", "test_work.fwb");
|
||||
|
||||
QTest::qExec(new instDialogCompileTest());
|
||||
|
||||
|
||||
8
src/unit_tests/instDialogInspectTest/CMakeLists.txt
Normal file
8
src/unit_tests/instDialogInspectTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(instDialogInspectTest instDialogInspectTest.cpp main_instDialogInspectTest.cpp)
|
||||
add_test(NAME instDialogInspectTest COMMAND instDialogInspectTest)
|
||||
|
||||
target_link_libraries(instDialogInspectTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
|
||||
file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
@ -56,6 +55,7 @@ int main(int argc, char** argv)
|
||||
|
||||
build_app(argc, argv, &app, &st);
|
||||
|
||||
QFile::copy("test.fwb", "test_work.fwb");
|
||||
|
||||
QTest::qExec(new instDialogInspectTest());
|
||||
|
||||
|
||||
8
src/unit_tests/instDialogInstallTest/CMakeLists.txt
Normal file
8
src/unit_tests/instDialogInstallTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(instDialogInstallTest instDialogInstallTest.cpp main_instDialogInstallTest.cpp)
|
||||
add_test(NAME instDialogInstallTest COMMAND instDialogInstallTest)
|
||||
|
||||
target_link_libraries(instDialogInstallTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
|
||||
file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
@ -56,6 +55,7 @@ int main(int argc, char** argv)
|
||||
|
||||
build_app(argc, argv, &app, &st);
|
||||
|
||||
QFile::copy("test.fwb", "test_work.fwb");
|
||||
|
||||
QTest::qExec(new instDialogInstallTest());
|
||||
|
||||
|
||||
8
src/unit_tests/instDialogObjectListTest/CMakeLists.txt
Normal file
8
src/unit_tests/instDialogObjectListTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(instDialogObjectListTest instDialogObjectListTest.cpp main_instDialogObjectListTest.cpp)
|
||||
add_test(NAME instDialogObjectListTest COMMAND instDialogObjectListTest)
|
||||
|
||||
target_link_libraries(instDialogObjectListTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
|
||||
file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
@ -56,6 +55,7 @@ int main(int argc, char** argv)
|
||||
|
||||
build_app(argc, argv, &app, &st);
|
||||
|
||||
QFile::copy("test.fwb", "test_work.fwb");
|
||||
|
||||
QTest::qExec(new instDialogObjectListTest());
|
||||
|
||||
|
||||
6
src/unit_tests/main/CMakeLists.txt
Normal file
6
src/unit_tests/main/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
add_library(test_main STATIC main.cpp)
|
||||
|
||||
target_link_libraries(test_main gui)
|
||||
|
||||
qt5_use_modules(test_main Test)
|
||||
|
||||
8
src/unit_tests/newClusterDialogTest/CMakeLists.txt
Normal file
8
src/unit_tests/newClusterDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(newClusterDialogTest newClusterDialogTest.cpp main_newClusterDialogTest.cpp)
|
||||
add_test(NAME newClusterDialogTest COMMAND newClusterDialogTest)
|
||||
|
||||
target_link_libraries(newClusterDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
|
||||
file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
@ -56,6 +55,7 @@ int main(int argc, char** argv)
|
||||
|
||||
build_app(argc, argv, &app, &st);
|
||||
|
||||
QFile::copy("test.fwb", "test_work.fwb");
|
||||
|
||||
QTest::qExec(new newClusterDialogTest());
|
||||
|
||||
|
||||
4
src/unit_tests/parseCommandLineTest/CMakeLists.txt
Normal file
4
src/unit_tests/parseCommandLineTest/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_executable(parseCommandLineTest parseCommandLineTest.cpp main_parseCommandLineTest.cpp)
|
||||
add_test(NAME parseCommandLineTest COMMAND parseCommandLineTest)
|
||||
|
||||
target_link_libraries(parseCommandLineTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit)
|
||||
@ -38,7 +38,6 @@ void *mw = nullptr;
|
||||
void *st = nullptr;
|
||||
void *app = nullptr;
|
||||
void *wfl;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
int main( int, char** )
|
||||
{
|
||||
|
||||
6
src/unit_tests/startTipDialogTest/CMakeLists.txt
Normal file
6
src/unit_tests/startTipDialogTest/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_executable(startTipDialogTest startTipDialogTest.cpp main_startTipDialogTest.cpp)
|
||||
add_test(NAME startTipDialogTest COMMAND startTipDialogTest)
|
||||
|
||||
target_link_libraries(startTipDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test)
|
||||
@ -41,7 +41,6 @@ int fwbdebug = 0;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
int sig = FWB_SIG;
|
||||
|
||||
|
||||
extern void build_app(int argc, char** argv,
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "startTipDialogTest.h"
|
||||
#include "FWWindow.h"
|
||||
#include "FWBApplication.h"
|
||||
#include "FWObjectClipboard.h"
|
||||
#include "StartTipDialog.h"
|
||||
#include <QFile>
|
||||
#include "global.h"
|
||||
@ -46,6 +47,7 @@ void startTipDialogTest::testDialogAppear()
|
||||
{
|
||||
st->setBool("UI/NoStartTip", false);
|
||||
st->setBool("UI/FirstRun", true);
|
||||
new FWObjectClipboard();
|
||||
mw = new FWWindow();
|
||||
mw->show();
|
||||
mw->startupLoad();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user