From a550f7863bff0792c8972609869d409b77efc1dd Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Mon, 15 Mar 2021 10:45:45 +0100 Subject: - added hello world test with command style --- src/testing/testing_api_cmd_hello_world.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/testing/testing_api_cmd_hello_world.c') diff --git a/src/testing/testing_api_cmd_hello_world.c b/src/testing/testing_api_cmd_hello_world.c index 8aa4a2f1c..8c1d7353d 100644 --- a/src/testing/testing_api_cmd_hello_world.c +++ b/src/testing/testing_api_cmd_hello_world.c @@ -29,6 +29,7 @@ struct HelloWorldState { char *message; + const char *birthLabel; }; /** @@ -43,7 +44,7 @@ hello_world_cleanup (void *cls, { struct HelloWorldState *hs = cls; GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Cleaning up message %s", + "Cleaning up message %s\n", hs->message); } @@ -78,11 +79,17 @@ hello_world_run (void *cls, struct GNUNET_TESTING_Interpreter *is) { struct HelloWorldState *hs = cls; + const struct GNUNET_TESTING_Command *birth_cmd; + + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "%s\n", + hs->message); + birth_cmd = GNUNET_TESTING_interpreter_lookup_command (hs->birthLabel); + GNUNET_TESTING_get_trait_what_am_i (birth_cmd, &hs->message); GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "%s", + "Now I am a %s\n", hs->message); - GNUNET_TESTING_get_trait_what_am_i (cmd, - hs->message); + GNUNET_TESTING_interpreter_next (is); } /** @@ -94,12 +101,14 @@ hello_world_run (void *cls, */ struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_hello_world (const char *label, + const char *birthLabel, char *message) { struct HelloWorldState *hs; hs = GNUNET_new (struct HelloWorldState); - hs->message = "Hello World, I am nobody!"; + hs->message = "Hello World, I was nobody!"; + hs->birthLabel = birthLabel; struct GNUNET_TESTING_Command cmd = { .cls = hs, -- cgit v1.2.3