Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add more standalone testing logic #63

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class extension_tester_t {
extension_tester_t &operator=(const extension_tester_t &&) = delete;
// @}

void add_addon_name(const char *addon_name) {
void set_test_mode_single(const char *addon_name) {
TEN_ASSERT(addon_name, "Invalid argument.");
ten_extension_tester_add_addon_name(c_extension_tester, addon_name);
ten_extension_tester_set_test_mode_single(c_extension_tester, addon_name);
}

void add_addon_base_dir(const char *addon_path) {
Expand Down
5 changes: 4 additions & 1 deletion core/include/ten_runtime/test/extension_tester.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ TEN_RUNTIME_API ten_extension_tester_t *ten_extension_tester_create(

TEN_RUNTIME_API void ten_extension_tester_destroy(ten_extension_tester_t *self);

TEN_RUNTIME_API void ten_extension_tester_add_addon_name(
// Testing a single extension, all messages input by the tester will be directed
// to this extension, and all outputs from the extension will be sent back to
// the tester.
TEN_RUNTIME_API void ten_extension_tester_set_test_mode_single(
ten_extension_tester_t *self, const char *addon_name);

TEN_RUNTIME_API void ten_extension_tester_add_addon_base_dir(
Expand Down
4 changes: 2 additions & 2 deletions core/src/ten_runtime/test/extension_tester.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ ten_extension_tester_t *ten_extension_tester_create(
return self;
}

void ten_extension_tester_add_addon_name(ten_extension_tester_t *self,
const char *addon_name) {
void ten_extension_tester_set_test_mode_single(ten_extension_tester_t *self,
const char *addon_name) {
TEN_ASSERT(self && ten_extension_tester_check_integrity(self, true),
"Invalid argument.");
TEN_ASSERT(addon_name, "Invalid argument.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ TEST(Test, Basic) { // NOLINT

ten_string_destroy(path);

tester->add_addon_name("default_extension_cpp");
tester->set_test_mode_single("default_extension_cpp");

tester->run();

Expand Down
2 changes: 1 addition & 1 deletion tests/ten_runtime/smoke/standalone_test/basic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class extension_tester_1 : public ten::extension_tester_t {

TEST(StandaloneTest, Basic) { // NOLINT
auto *tester = new extension_tester_1();
tester->add_addon_name("standalone_test_basic__test_extension_1");
tester->set_test_mode_single("standalone_test_basic__test_extension_1");

bool rc = tester->run();
TEN_ASSERT(rc, "Should not happen.");
Expand Down
2 changes: 1 addition & 1 deletion tests/ten_runtime/smoke/standalone_test/basic_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void ten_extension_tester_on_start(TEN_UNUSED ten_extension_tester_t *tester,
TEST(StandaloneTest, BasicC) { // NOLINT
ten_extension_tester_t *tester =
ten_extension_tester_create(ten_extension_tester_on_start, nullptr);
ten_extension_tester_add_addon_name(
ten_extension_tester_set_test_mode_single(
tester, "standalone_test_basic_c__test_extension_1");

bool rc = ten_extension_tester_run(tester);
Expand Down
2 changes: 1 addition & 1 deletion tests/ten_runtime/smoke/standalone_test/on_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class extension_tester_1 : public ten::extension_tester_t {

TEST(StandaloneTest, OnCmd) { // NOLINT
auto *tester = new extension_tester_1();
tester->add_addon_name("standalone_test_on_cmd__test_extension_1");
tester->set_test_mode_single("standalone_test_on_cmd__test_extension_1");

bool rc = tester->run();
TEN_ASSERT(rc, "Should not happen.");
Expand Down
2 changes: 1 addition & 1 deletion tests/ten_runtime/smoke/standalone_test/on_cmd_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void ten_extension_tester_on_cmd(TEN_UNUSED ten_extension_tester_t *tester,
TEST(StandaloneTest, OnCmdC) { // NOLINT
ten_extension_tester_t *tester = ten_extension_tester_create(
ten_extension_tester_on_start, ten_extension_tester_on_cmd);
ten_extension_tester_add_addon_name(
ten_extension_tester_set_test_mode_single(
tester, "standalone_test_on_cmd_c__test_extension_1");

bool rc = ten_extension_tester_run(tester);
Expand Down
Loading