testing working, and fixed memory leak in replace with substring function

This commit is contained in:
herbglitch 2024-08-31 06:09:33 -06:00
parent 4c0c5d377d
commit 5de968688c
7 changed files with 131 additions and 75 deletions

View file

@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.25)
set(ARCHEUS_STD_VERSION 0.0.0)
project(archeus_std LANGUAGES C VERSION ${ARCHEUS_STD_VERSION} DESCRIPTION "libarcheus_std standard archeus c library")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(GNUInstallDirs)
function(print var)
@ -23,6 +25,7 @@ add_compile_options(
# ~ OPTIONS ~ #
option(ARCHEUS_STD_DEFAULT_CONFIG "Build with default config keys" ON)
option(ARCHEUS_STD_TESTS "Build with tests" OFF)
set(ARCHEUS_STD_CONSOLE_BACKEND "NONE" CACHE STRING "Console Backend to build with")
set_property(CACHE ARCHEUS_STD_CONSOLE_BACKEND PROPERTY STRINGS NONE NCURSES)
@ -59,6 +62,7 @@ set(ARCHEUS_STD_SOURCES
src/std/handler.c
src/std/hashtable.c
src/std/io.c
src/std/lexer.c
src/std/queue.c
src/std/stack.c
src/std/string.c
@ -79,15 +83,6 @@ set(ARCHEUS_STD_SOURCES
src/engine/state.c
)
#TODO: add this
#add_executable(tests
# tests/test.c
#
# tests/std/vector.c
#
# ${ARCHEUS_STD_SOURCES}
#)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
string(APPEND ARCHEUS_STD_FLAGS "-Wall -Werror -g -ggdb -DARC_DEBUG ")
endif()
@ -127,6 +122,21 @@ libssh_check_and_init_needed(ARCHEUS_STD_FLAGS ARCHEUS_STD_SOURCES ${ARCHEUS_STD
set(CMAKE_C_FLAGS ${ARCHEUS_STD_FLAGS})
if(ARCHEUS_STD_TESTS)
add_executable(tests
tests/test.c
#tests/std/vector.c
tests/std/lexer.c
${ARCHEUS_STD_SOURCES}
)
target_compile_options(tests PUBLIC "-DARC_DEBUG_LOG_STREAM_OVERRIDE")
target_include_directories(tests ${ARCHEUS_STD_INCLUDE_DIRECTORIES})
target_link_libraries(tests ${ARCHEUS_STD_LINK_LIBRARIES})
endif()
if(WIN32 AND NOT MSVC)
add_library(archeus_std STATIC ${ARCHEUS_STD_SOURCES})
else()