Added test program for SeerUtl.cpp.

This commit is contained in:
Ernie Pasveer
2025-02-22 13:23:15 -06:00
parent 0f321e03cb
commit fffac83f9f
6 changed files with 143 additions and 2 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ MacOS may need help finding the cmake config file for Qt6.
Sometimes you need to specify a newer version of g++/gcc. Your installation
may have an old version as the default.
% cmake -D CMAKE_C_COMPILER=gcc-13 -D CMAKE_CXX_COMPILER=g++-13 -DQTVERSION=QT6 -DCMAKE_BUILD_TYPE=Debug ..
% cmake -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 -DQTVERSION=QT6 -DCMAKE_BUILD_TYPE=Debug ..
Checkout the Seer wiki for more build info.
+6
View File
@@ -0,0 +1,6 @@
seerutl
cmake_install.cmake
CMakeCache.txt
Makefile
CMakeFiles
.qt/*
+75
View File
@@ -0,0 +1,75 @@
cmake_minimum_required(VERSION 3.1.0)
project(seerutl VERSION 1.0 LANGUAGES CXX)
set(PROJECT_NAME seerutl)
if(NOT DEFINED QTVERSION)
set(QTVERSION "QT6" CACHE STRING "" FORCE)
endif()
if(${QTVERSION} STREQUAL "QT6")
message("-- Compile with QT6")
elseif(${QTVERSION} STREQUAL "QT5")
message("-- Compile with QT5")
else()
message(FATAL_ERROR "-- Use -DQTVERSION=QT5|QT6 not \"${QTVERSION}\"")
endif()
# Find includes in the build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_PREFIX_PATH ${QTDIR})
if(${QTVERSION} STREQUAL "QT6")
find_package(Qt6 COMPONENTS REQUIRED Core)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
elseif(${QTVERSION} STREQUAL "QT5")
find_package(Qt5 COMPONENTS REQUIRED Core)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
set(HEADER_FILES
../SeerUtl.h
)
set(SOURCE_FILES
../seerutl.cpp
../SeerUtl.cpp
)
# Set non-Debug build as GUI application.
# Debug build remains consle application.
if(NOT CMAKE_BUILD_TYPE MATCHES Debug) #Release, RelWithDebInfo and MinSizeRel
if(WIN32) # Check if we are on Windows
set(SYSTEM_TYPE WIN32)
endif()
message("-- System type is " ${SYSTEM_TYPE})
endif()
# for Linux, BSD, Solaris, Minix
if(UNIX AND NOT APPLE)
add_compile_options(-Wall -Wextra -Wunused-result -pedantic) # -Werror -Wdeprecated-copy
endif()
add_definitions(-DQT_DEPRECATED_WARNINGS)
add_executable(${PROJECT_NAME} ${SYSTEM_TYPE} ${SOURCE_FILES})
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
if(${QTVERSION} STREQUAL "QT6")
target_link_libraries(${PROJECT_NAME} Qt6::Core)
elseif(${QTVERSION} STREQUAL "QT5")
target_link_libraries(${PROJECT_NAME} Qt5::Core)
endif()
+37
View File
@@ -0,0 +1,37 @@
Notes for building 'seerutl' with cmake. 'seerutl' is a test program
for testing the SeerUtl functions. It is used for my developent. It
is NOT needed for the average person installing Seergdb from source.
# Note the single '.'. The CMakeLists.txt file is local to this build directory.
% cd seer/src/build_seerutl
% cmake -DCMAKE_BUILD_TYPE=Debug . # Debug release -g.
% cmake -DCMAKE_BUILD_TYPE=Release . # Optimized release -O.
% cmake -DCMAKE_CXX_FLAGS=-Wall . # With all compile warnings turned on.
# Specify a compiler version with debug.
% cmake -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_BUILD_TYPE=Debug .
The above defaults to Qt6. If you want to use Qt5, add the '-DQTVERSION' flag.
% cmake -DQTVERSION=QT5 -DCMAKE_BUILD_TYPE=Debug .
Once cmake is run, then just build 'seerutl'.
% make clean # Clean files.
% make seerutl # Build 'seerutl'.
% sudo make install # Install it.
Another way to ask cmake to do the build for you.
% cmake --build . --config Release
% sudo cmake --install .
MacOS may need help finding the cmake config file for Qt6.
% cmake -DCMAKE_PREFIX_PATH=/usr/local/opt/qt6/ -DCMAKE_BUILD_TYPE=Release ..
Sometimes you need to specify a newer version of g++/gcc. Your installation
may have an old version as the default.
% cmake -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 -DQTVERSION=QT6 -DCMAKE_BUILD_TYPE=Debug ..
+19
View File
@@ -0,0 +1,19 @@
#include "SeerUtl.h"
#include <QtCore/QDebug>
int main (int argc, char* argv[]) {
Q_UNUSED(argc);
Q_UNUSED(argv);
QString text("Function\\n1");
QString result;
result = Seer::filterEscapes(text);
qDebug().noquote() << text;
qDebug().noquote() << result;
return 1;
}
+5 -1
View File
@@ -39,10 +39,14 @@ The following example shows a GDB session in which the above commands have been
-skip-list
^done,list="Num Enb Glob File RE Functionn1 y n <none> n std::vector<int, std::allocator<int> >::back()n2 y n <none> n std::unique_ptr<int, std::default_delete<int> >::operator*() constn"
^done,list="Num Enb Glob File RE Functionn
1 y n <none> n std::vector<int, std::allocator<int> >::back()n
2 y n <none> n std::unique_ptr<int, std::default_delete<int> >::operator*() constn"
Run Seer this way:
$ /usr/local/bin/seergdb --project=project.seer
[ ] The return string has 'n' characters but I think they should be '\n'
[ ] The return string has 'n' characters but I think they should be '\n'. Seer parsing bug with escaped '\n'????
[ ] Handle the parsing of the return string and return a python table.