Compare commits
1 Commits
master
...
feature/pr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cf95e41ed |
@ -9,7 +9,6 @@ project(skullc
|
|||||||
CXX
|
CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
#list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
|
||||||
|
|
||||||
option(SKULLC_WITH_TESTS "Enable unit testing." OFF)
|
option(SKULLC_WITH_TESTS "Enable unit testing." OFF)
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
|
||||||
|
|
||||||
option(SKULLC_TESTS_WITH_SANITIZERS "Enable sanitizers for tests." ON)
|
option(SKULLC_TESTS_WITH_SANITIZERS "Enable sanitizers for tests." ON)
|
||||||
|
|
||||||
@ -10,6 +10,20 @@ FetchContent_Declare(Catch2
|
|||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(Catch2)
|
FetchContent_MakeAvailable(Catch2)
|
||||||
|
|
||||||
|
FetchContent_Declare(nanopb
|
||||||
|
GIT_REPOSITORY https://github.com/nanopb/nanopb.git
|
||||||
|
GIT_TAG origin/master
|
||||||
|
FIND_PACKAGE_ARGS
|
||||||
|
)
|
||||||
|
FetchContent_GetProperties(nanopb)
|
||||||
|
if (NOT nanopb_POPULATED)
|
||||||
|
FetchContent_Populate(nanopb)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${nanopb_SOURCE_DIR}/extra")
|
||||||
|
find_package(Nanopb REQUIRED)
|
||||||
|
|
||||||
|
|
||||||
if(SKULLC_TESTS_WITH_SANITIZERS)
|
if(SKULLC_TESTS_WITH_SANITIZERS)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fno-sanitize-recover")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fno-sanitize-recover")
|
||||||
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fno-sanitize-recover")
|
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fno-sanitize-recover")
|
||||||
@ -33,17 +47,20 @@ add_executable(tests
|
|||||||
filters.cpp
|
filters.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
nanopb_generate_cpp(TARGET proto RELPATH nanopb nanopb/simple.proto)
|
||||||
|
|
||||||
target_link_libraries(tests
|
target_link_libraries(tests
|
||||||
PUBLIC
|
PUBLIC
|
||||||
skullc::utility
|
skullc::utility
|
||||||
skullc::messaging
|
skullc::messaging
|
||||||
skullc::peripherals
|
skullc::peripherals
|
||||||
Catch2::Catch2
|
Catch2::Catch2
|
||||||
|
proto
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(tests
|
set_target_properties(tests
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
CXX_STANDARD 17
|
CXX_STANDARD 23
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib)
|
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib)
|
||||||
|
|||||||
6
Tests/nanopb/simple.proto
Normal file
6
Tests/nanopb/simple.proto
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
message SimpleMessage {
|
||||||
|
required int32 lucky_number = 1;
|
||||||
|
}
|
||||||
@ -5,6 +5,7 @@
|
|||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
#include <messaging_packet.hpp>
|
#include <messaging_packet.hpp>
|
||||||
|
#include "simple.pb.h"
|
||||||
|
|
||||||
TEST_CASE("Packet copy_data_in copies data in.", "[messaging],[packet]")
|
TEST_CASE("Packet copy_data_in copies data in.", "[messaging],[packet]")
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user