Segmentation fault in google test

144 Views Asked by At

Segmentation error when using Google tests

test.cpp:

#include <interface.h>
#include <gtest/gtest.h>

TEST(ParseDelimited, DefaultTest){
    
    EXPECT_EQ(for_test(), 1);
};

src/interface.h:

int for_test()
{
    return 1;
}

tests/CMakeLists.txt

cmake_minimum_required(VERSION 3.16.3)
project(Tests)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include_directories(${GTEST_INCLUDE_DIRS})

add_executable(Test tests.cpp)
target_link_libraries(Test
    gtest gtest_main
    pthread
    )

CMakeLists.txt:

cmake_minimum_required(VERSION 3.16.3)
cmake_policy(SET CMP0016 NEW)

project(CCSDS VERSION 1.0.0 DESCRIPTION "Project")

include_directories(${CMAKE_SOURCE_DIR}/src)

add_subdirectory(tests)
enable_testing()

I can't figure out where there might be a segmentation fault.

I tried to change the functions in the text, tried to run it without using the interface.h but nothing helped

0

There are 0 best solutions below