mirror of
https://github.com/simon987/libmailparse.git
synced 2025-04-10 05:46:44 +00:00
Initial commit
This commit is contained in:
parent
3393e181d9
commit
ddac1a0f50
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
.idea/
|
||||||
|
cmake-build-debug
|
||||||
|
CMakeFiles
|
||||||
|
Testing
|
||||||
|
cmake_install.cmake
|
||||||
|
CMakeCache.txt
|
||||||
|
*.a
|
||||||
|
*.cbp
|
||||||
|
mailparse_test
|
||||||
|
Makefile
|
27
CMakeLists.txt
Normal file
27
CMakeLists.txt
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.17)
|
||||||
|
project(mailparse)
|
||||||
|
|
||||||
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
|
||||||
|
set(BUILD_TESTS on)
|
||||||
|
|
||||||
|
add_library(mailparse src/library.c src/library.h)
|
||||||
|
set_target_properties(mailparse PROPERTIES LINKER_LANGUAGE C)
|
||||||
|
|
||||||
|
if (BUILD_TESTS)
|
||||||
|
find_package(GTest CONFIG REQUIRED)
|
||||||
|
|
||||||
|
add_executable(mailparse_test test/main.cpp)
|
||||||
|
target_compile_options(mailparse_test
|
||||||
|
PRIVATE
|
||||||
|
-g
|
||||||
|
-fsanitize=address
|
||||||
|
-fno-omit-frame-pointer)
|
||||||
|
target_link_libraries(mailparse_test
|
||||||
|
PRIVATE
|
||||||
|
GTest::gtest
|
||||||
|
GTest::gtest_main
|
||||||
|
-fsanitize=address
|
||||||
|
stdc++
|
||||||
|
mailparse)
|
||||||
|
endif ()
|
8
src/library.c
Normal file
8
src/library.c
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include "library.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int hello() {
|
||||||
|
printf("Hello, World!\n");
|
||||||
|
return 12;
|
||||||
|
}
|
6
src/library.h
Normal file
6
src/library.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef LIBMAILPARSE_LIBRARY_H
|
||||||
|
#define LIBMAILPARSE_LIBRARY_H
|
||||||
|
|
||||||
|
int hello();
|
||||||
|
|
||||||
|
#endif
|
17
test/main.cpp
Normal file
17
test/main.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "../src/library.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(PlaceHolderTest, Test1) {
|
||||||
|
|
||||||
|
int ret = hello();
|
||||||
|
|
||||||
|
ASSERT_EQ(ret, 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
return RUN_ALL_TESTS();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user