-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'task/#24776-check_utest_setup_for_libelos-cpp' into 'in…
…tegration' Task #24776: check utest setup for libelos cpp See merge request elektrobit/base-os/elos!139
- Loading branch information
Showing
19 changed files
with
299 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
add_subdirectory(connect) | ||
add_subdirectory(disconnect) | ||
add_subdirectory(publish) | ||
add_subdirectory(subscribe) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# SPDX-License-Identifier: MIT | ||
find_package(safu 0.56.2 REQUIRED) | ||
find_package(cmocka_mocks 0.54.2 REQUIRED) | ||
|
||
enable_language(CXX) | ||
|
||
create_unit_test( | ||
NAME | ||
test_libelos-cpp_connect_utest | ||
SOURCES | ||
case_success.cpp | ||
connect_utest.cpp | ||
LIBRARIES | ||
libelos-cpp_static | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: MIT | ||
#include "connect_utest.h" | ||
|
||
int elosTestConnectSuccessSetup(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
int elosTestConnectSuccessTeardown(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
void elosTestConnectSuccess(UNUSED void **state) { | ||
using namespace elos; | ||
elosSession_t *testSession = NULL; | ||
safuResultE_t result; | ||
Elos testObject; | ||
|
||
TEST("connect"); | ||
SHOULD("%s", "create successfully a tcp-ip connection"); | ||
|
||
result = testObject.connect("0.0.0.0", 54321, &testSession); | ||
assert_int_equal(result, SAFU_RESULT_OK); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-License-Identifier: MIT | ||
#include "connect_utest.h" | ||
|
||
TEST_SUITE_FUNC_PROTOTYPES(connectUtest) | ||
|
||
int main() { | ||
const struct CMUnitTest tests[] = { | ||
TEST_CASE(elosTestConnectSuccess), | ||
}; | ||
|
||
return RUN_TEST_SUITE(tests, connectUtest); | ||
} | ||
|
||
static int connectUtestSetup(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
static int connectUtestTeardown(UNUSED void **state) { | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
#pragma once | ||
#include <setjmp.h> | ||
#include <stdarg.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
extern "C" { | ||
#include <cmocka.h> | ||
} | ||
#include <cmocka_extensions/cmocka_extensions.h> | ||
#include <elos/libelos-cpp/libelos-cpp.h> | ||
|
||
TEST_CASE_FUNC_PROTOTYPES(elosTestConnectSuccess) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# SPDX-License-Identifier: MIT | ||
find_package(safu 0.56.2 REQUIRED) | ||
find_package(cmocka_mocks 0.54.2 REQUIRED) | ||
|
||
enable_language(CXX) | ||
|
||
create_unit_test( | ||
NAME | ||
test_libelos-cpp_disconnect_utest | ||
SOURCES | ||
case_success.cpp | ||
disconnect_utest.cpp | ||
LIBRARIES | ||
libelos-cpp_static | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: MIT | ||
#include "disconnect_utest.h" | ||
|
||
int elosTestDisconnectSuccessSetup(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
int elosTestDisconnectSuccessTeardown(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
void elosTestDisconnectSuccess(UNUSED void **state) { | ||
using namespace elos; | ||
elosSession_t *testSession = NULL; | ||
safuResultE_t result; | ||
Elos testObject; | ||
|
||
TEST("disconnect"); | ||
SHOULD("%s", "successfully close a connection"); | ||
|
||
result = testObject.disconnect(&testSession); | ||
assert_int_equal(result, SAFU_RESULT_OK); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-License-Identifier: MIT | ||
#include "disconnect_utest.h" | ||
|
||
TEST_SUITE_FUNC_PROTOTYPES(disconnectUtest) | ||
|
||
int main() { | ||
const struct CMUnitTest tests[] = { | ||
TEST_CASE(elosTestDisconnectSuccess), | ||
}; | ||
|
||
return RUN_TEST_SUITE(tests, disconnectUtest); | ||
} | ||
|
||
static int disconnectUtestSetup(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
static int disconnectUtestTeardown(UNUSED void **state) { | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
#pragma once | ||
#include <setjmp.h> | ||
#include <stdarg.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
extern "C" { | ||
#include <cmocka.h> | ||
} | ||
#include <cmocka_extensions/cmocka_extensions.h> | ||
#include <elos/libelos-cpp/libelos-cpp.h> | ||
|
||
TEST_CASE_FUNC_PROTOTYPES(elosTestDisconnectSuccess) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# SPDX-License-Identifier: MIT | ||
find_package(safu 0.56.2 REQUIRED) | ||
find_package(cmocka_mocks 0.54.2 REQUIRED) | ||
|
||
enable_language(CXX) | ||
|
||
create_unit_test( | ||
NAME | ||
test_libelos-cpp_publish_utest | ||
SOURCES | ||
case_success.cpp | ||
publish_utest.cpp | ||
LIBRARIES | ||
libelos-cpp_static | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
#include "publish_utest.h" | ||
|
||
int elosTestPublishSuccessSetup(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
int elosTestPublishSuccessTeardown(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
void elosTestPublishSuccess(UNUSED void **state) { | ||
using namespace elos; | ||
elosSession_t *testSession = NULL; | ||
elosEvent_t *testEvent = NULL; | ||
safuResultE_t result; | ||
Elos testObject; | ||
|
||
TEST("publish"); | ||
SHOULD("%s", "successfully publish an event"); | ||
|
||
result = testObject.publish(&testSession, testEvent); | ||
assert_int_equal(result, SAFU_RESULT_OK); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-License-Identifier: MIT | ||
#include "publish_utest.h" | ||
|
||
TEST_SUITE_FUNC_PROTOTYPES(publishUtest) | ||
|
||
int main() { | ||
const struct CMUnitTest tests[] = { | ||
TEST_CASE(elosTestPublishSuccess), | ||
}; | ||
|
||
return RUN_TEST_SUITE(tests, publishUtest); | ||
} | ||
|
||
static int publishUtestSetup(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
static int publishUtestTeardown(UNUSED void **state) { | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
#pragma once | ||
#include <setjmp.h> | ||
#include <stdarg.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
extern "C" { | ||
#include <cmocka.h> | ||
} | ||
#include <cmocka_extensions/cmocka_extensions.h> | ||
#include <elos/libelos-cpp/libelos-cpp.h> | ||
|
||
TEST_CASE_FUNC_PROTOTYPES(elosTestPublishSuccess) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# SPDX-License-Identifier: MIT | ||
find_package(safu 0.56.2 REQUIRED) | ||
find_package(cmocka_mocks 0.54.2 REQUIRED) | ||
|
||
enable_language(CXX) | ||
|
||
create_unit_test( | ||
NAME | ||
test_libelos-cpp_subscribe_utest | ||
SOURCES | ||
case_success.cpp | ||
subscribe_utest.cpp | ||
LIBRARIES | ||
libelos-cpp_static | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: MIT | ||
#include <cstddef> | ||
|
||
#include "subscribe_utest.h" | ||
|
||
int elosTestSubscribeSuccessSetup(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
int elosTestSubscribeSuccessTeardown(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
void elosTestSubscribeSuccess(UNUSED void **state) { | ||
using namespace elos; | ||
elosSession_t *testSession = NULL; | ||
const char *testFilterRule = NULL; | ||
size_t testSize = 0; | ||
elosEventQueueId_t *testQueue = NULL; | ||
safuResultE_t result; | ||
Elos testObject; | ||
|
||
TEST("subscribe"); | ||
SHOULD("%s", "Create a subscription message, send it, evaluate the response and return list of message queue ids"); | ||
|
||
result = testObject.subscribe(&testSession, &testFilterRule, testSize, testQueue); | ||
assert_int_equal(result, SAFU_RESULT_OK); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-License-Identifier: MIT | ||
#include "subscribe_utest.h" | ||
|
||
TEST_SUITE_FUNC_PROTOTYPES(subscribeUtest) | ||
|
||
int main() { | ||
const struct CMUnitTest tests[] = { | ||
TEST_CASE(elosTestSubscribeSuccess), | ||
}; | ||
|
||
return RUN_TEST_SUITE(tests, subscribeUtest); | ||
} | ||
|
||
static int subscribeUtestSetup(UNUSED void **state) { | ||
return 0; | ||
} | ||
|
||
static int subscribeUtestTeardown(UNUSED void **state) { | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
#pragma once | ||
#include <setjmp.h> | ||
#include <stdarg.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
extern "C" { | ||
#include <cmocka.h> | ||
} | ||
#include <cmocka_extensions/cmocka_extensions.h> | ||
#include <elos/libelos-cpp/libelos-cpp.h> | ||
|
||
TEST_CASE_FUNC_PROTOTYPES(elosTestSubscribeSuccess) |