Add all unit tests
This commit is contained in:
65
tests/ANSONVIF-UnitTest/ANSONVIF-UnitTest.cpp
Normal file
65
tests/ANSONVIF-UnitTest/ANSONVIF-UnitTest.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#include <iostream>
|
||||
#include "ANSONVIF.h"
|
||||
#include "ANSOpenCV.h"
|
||||
int OnvifTest() {
|
||||
ANSCENTER::ANSOnvifClient* infHandle;
|
||||
std::vector<std::string> profileList;
|
||||
CreateANSOnvifHandle(&infHandle, "");
|
||||
SearchANSOnvifSpecificProfiles(&infHandle, "192.168.1.87", 8000, "admin", "admin123", profileList);
|
||||
for (int i = 0; i < profileList.size(); i++) {
|
||||
std::cout << "Profile:" << profileList.at(i) << std::endl;
|
||||
}
|
||||
ReleaseANSOnvifHandle(&infHandle);
|
||||
|
||||
std::cout << "Hello World!\n";
|
||||
}
|
||||
int OnvifSearchDevicesTest() {
|
||||
ANSCENTER::ANSOnvifClient* infHandle;
|
||||
std::vector<std::string> deviceList;
|
||||
CreateANSOnvifHandle(&infHandle, "");
|
||||
std::cout << "Start searching devices on the network. Please wait..." << std::endl;
|
||||
for (int j = 0; j < 1; j++) {
|
||||
sleep(1);//sleep for 1 second
|
||||
int result = SearchANSOnvifDevices(&infHandle, 30,deviceList);
|
||||
if (deviceList.size() > 0) {
|
||||
for (int i = 0; i < deviceList.size(); i++) {
|
||||
std::cout << "Device [" << i << "] address: " << deviceList.at(i) << std::endl;
|
||||
}
|
||||
}
|
||||
std::cout << "Search device procedure is done." << std::endl;
|
||||
}
|
||||
std::vector<std::string> profileList;
|
||||
|
||||
SearchANSOnvifSpecificProfiles(&infHandle, "192.168.1.87", 8000, "admin", "admin123", profileList);
|
||||
for (int i = 0; i < profileList.size(); i++) {
|
||||
std::cout << "Profile:" << profileList.at(i) << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "Start searching devices on the network. Please wait..." << std::endl;
|
||||
for (int j = 0; j < 1; j++) {
|
||||
sleep(1);//sleep for 1 second
|
||||
int result = SearchANSOnvifDevices(&infHandle, 15,deviceList);
|
||||
if (deviceList.size() > 0) {
|
||||
for (int i = 0; i < deviceList.size(); i++) {
|
||||
std::cout << "Device [" << i << "] address: " << deviceList.at(i) << std::endl;
|
||||
}
|
||||
}
|
||||
std::cout << "Search device procedure is done." << std::endl;
|
||||
}
|
||||
|
||||
ReleaseANSOnvifHandle(&infHandle);
|
||||
return 0;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
ANSCENTER::ANSOPENCV::InitCameraNetwork();
|
||||
|
||||
|
||||
OnvifSearchDevicesTest();
|
||||
OnvifTest();
|
||||
return 0;
|
||||
|
||||
ANSCENTER::ANSOPENCV::DeinitCameraNetwork();
|
||||
|
||||
}
|
||||
|
||||
42
tests/ANSONVIF-UnitTest/CMakeLists.txt
Normal file
42
tests/ANSONVIF-UnitTest/CMakeLists.txt
Normal file
@@ -0,0 +1,42 @@
|
||||
# ANSONVIF Unit Test
|
||||
add_executable(ANSONVIF-UnitTest
|
||||
ANSONVIF-UnitTest.cpp
|
||||
)
|
||||
|
||||
target_include_directories(ANSONVIF-UnitTest PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/integrations/ANSONVIF
|
||||
${ANLS_ROOT}/ONVIF/include
|
||||
${CMAKE_SOURCE_DIR}/modules/ANSCV
|
||||
${CMAKE_SOURCE_DIR}/MediaClient
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/media
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/rtsp
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/rtp
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/bm
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/http
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/directx
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/rtmp
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/librtmp
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/srt
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/ffmpeg/include
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/openssl/include
|
||||
${CMAKE_SOURCE_DIR}/MediaClient/libsrt/include
|
||||
${ANLS_ROOT}/TurboJpeg
|
||||
${SHARED_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(ANSONVIF-UnitTest
|
||||
PRIVATE ANSONVIF
|
||||
PRIVATE ANSCV
|
||||
PRIVATE ANSLicensingSystem
|
||||
PRIVATE anslicensing
|
||||
PRIVATE labview
|
||||
PRIVATE opencv
|
||||
PRIVATE CUDA::cudart
|
||||
PRIVATE CUDA::nvjpeg
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(ANSONVIF-UnitTest PRIVATE ${WIN_COMMON_LIBS})
|
||||
endif()
|
||||
|
||||
target_compile_definitions(ANSONVIF-UnitTest PRIVATE UNICODE _UNICODE)
|
||||
Reference in New Issue
Block a user