Skip to content

Commit

Permalink
#674 Add array list element type testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pnoltes committed Feb 4, 2024
1 parent 21f379d commit f0ff9d9
Show file tree
Hide file tree
Showing 7 changed files with 330 additions and 97 deletions.
8 changes: 0 additions & 8 deletions bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,6 @@ TEST_F(LogBundleTestSuite, SinkLogControl) {

auto *list = control->currentSinks(control->handle);
EXPECT_EQ(3, celix_arrayList_size(list));
for (int i = 0; i < celix_arrayList_size(list); ++i) {
auto *item = celix_arrayList_get(list, i);
free(item);
}
celix_arrayList_destroy(list);


Expand Down Expand Up @@ -277,10 +273,6 @@ TEST_F(LogBundleTestSuite, LogServiceControl) {

auto *list = control->currentLogServices(control->handle);
EXPECT_EQ(4, celix_arrayList_size(list));
for (int i = 0; i < celix_arrayList_size(list); ++i) {
auto *item = celix_arrayList_get(list, i);
free(item);
}
celix_arrayList_destroy(list);

celix_bundleContext_stopTracker(ctx.get(), trkId1);
Expand Down
4 changes: 2 additions & 2 deletions bundles/logging/log_admin/src/celix_log_admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ static void celix_logAdmin_InfoCmd(celix_log_admin_t* admin, FILE* outStream, FI

fprintf(outStream, "Log Admin provided log services:\n");
for (int i = 0 ; i < celix_arrayList_size(logServices); ++i) {
char *name = celix_arrayList_get(logServices, i);
const char *name = celix_arrayList_getString(logServices, i);
celix_log_level_e level;
bool detailed;
bool found = celix_logAdmin_logServiceInfoEx(admin, name, &level, &detailed);
Expand All @@ -558,7 +558,7 @@ static void celix_logAdmin_InfoCmd(celix_log_admin_t* admin, FILE* outStream, FI
if (celix_arrayList_size(sinks) > 0) {
fprintf(outStream, "Log Admin found log sinks:\n");
for (int i = 0 ; i < celix_arrayList_size(sinks); ++i) {
char *name = celix_arrayList_get(sinks, i);
const char *name = celix_arrayList_getString(sinks, i);
bool enabled;
bool found = celix_logAdmin_sinkInfo(admin, name, &enabled);
if (found) {
Expand Down
12 changes: 12 additions & 0 deletions bundles/logging/log_service_api/include/celix_log_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,20 @@ typedef struct celix_log_control {

size_t (*setSinkEnabled)(void *handle, const char* select, bool enabled);

/**
* @brief Get a list of names for the log service provided by the log service.
* @param handle The service handle.
* @return A string array list.
* The array list is owned by the caller and should be destroyed by calling celix_arrayList_destroy.
*/
celix_array_list_t* (*currentLogServices)(void *handle);

/**
* @brief Get a list of sinks names used by the log service.
* @param handle The service handle.
* @return A string array list.
* The array list is owned by the caller and should be destroyed by calling celix_arrayList_destroy.
*/
celix_array_list_t* (*currentSinks)(void *handle);

bool (*logServiceInfo)(void *handle, const char* loggerName, celix_log_level_e* outActiveLogLevel);
Expand Down
2 changes: 1 addition & 1 deletion libs/utils/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ add_executable(test_utils
src/ThreadsTestSuite.cc
src/CelixErrnoTestSuite.cc
src/CelixUtilsAutoCleanupTestSuite.cc
src/ArrayListTestSuite.cc
src/DeprecatedHashmapTestSuite.cc
)

Expand All @@ -45,7 +46,6 @@ configure_file(resources/properties.txt ${CMAKE_CURRENT_BINARY_DIR}/resources-te

if (CELIX_CXX17)
add_library(test_utils_cxx17tests OBJECT
src/ArrayListTestSuite.cc #Uses constexpr
src/HashMapTestSuite.cc #Uses constexpr
)
target_link_libraries(test_utils_cxx17tests PRIVATE utils_cut Celix::utils GTest::gtest)
Expand Down
Loading

0 comments on commit f0ff9d9

Please sign in to comment.