Skip to content

Commit

Permalink
test: add test for C++ applications
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Jan 7, 2025
1 parent 816dc5a commit dd9b01b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include(sanitizer)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_STANDARD 11)

if(MSVC)
add_compile_options("/W3")
Expand Down Expand Up @@ -153,6 +154,8 @@ if(USE_OPENSSL)
)
endif()

list(APPEND SRCS cplusplus.cpp)


##############################################################################
#
Expand Down
25 changes: 25 additions & 0 deletions test/cplusplus.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @file cplusplus.cpp Emulate C++ applications
*
* Copyright (C) 2025 Alfred E. Heggestad
*/

#include <iostream>
#include <re_atomic.h>
#include <re.h>
#include "test.h"


#define DEBUG_MODULE "cplusplus"
#define DEBUG_LEVEL 5
#include <re_dbg.h>


int test_cplusplus(void)
{
std::cout << "test\n";

DEBUG_NOTICE("%H\n", sys_kernel_get, nullptr);

return 0;
}
1 change: 1 addition & 0 deletions test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ static const struct test tests_integration[] = {
TEST(test_tmr_jiffies_usec),
TEST(test_turn_thread),
TEST(test_thread_cnd_timedwait),
TEST(test_cplusplus),
};


Expand Down
10 changes: 10 additions & 0 deletions test/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@ int test_integration(const char *name, bool verbose);
int test_sipevent_network(void);
int test_sip_drequestf_network(void);

#ifdef __cplusplus
extern "C" {
#endif

int test_cplusplus(void);

#ifdef __cplusplus
}
#endif

/* High-level API */
int test_reg(const char *name, bool verbose);
int test_oom(const char *name, bool verbose);
Expand Down

0 comments on commit dd9b01b

Please sign in to comment.