diff options
author | t3sserakt <t3ss@posteo.de> | 2021-03-15 10:45:45 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-03-15 10:45:45 +0100 |
commit | a550f7863bff0792c8972609869d409b77efc1dd (patch) | |
tree | 3e176423be8a3bdafb16d8891ebc3befc7fe3ffe /src/testing/testing_api_cmd_hello_world_birth.c | |
parent | b47586e76bc4f3c2c4ab6829028b5dd2f03e702d (diff) | |
download | gnunet-a550f7863bff0792c8972609869d409b77efc1dd.tar.gz gnunet-a550f7863bff0792c8972609869d409b77efc1dd.zip |
- added hello world test with command style
Diffstat (limited to 'src/testing/testing_api_cmd_hello_world_birth.c')
-rw-r--r-- | src/testing/testing_api_cmd_hello_world_birth.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/testing/testing_api_cmd_hello_world_birth.c b/src/testing/testing_api_cmd_hello_world_birth.c index 613fc3613..546b30212 100644 --- a/src/testing/testing_api_cmd_hello_world_birth.c +++ b/src/testing/testing_api_cmd_hello_world_birth.c | |||
@@ -45,7 +45,7 @@ hello_world_birth_cleanup (void *cls, | |||
45 | { | 45 | { |
46 | struct HelloWorldBirthState *hbs = cls; | 46 | struct HelloWorldBirthState *hbs = cls; |
47 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 47 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
48 | "Finished birth of %s", | 48 | "Finished birth of %s\n", |
49 | hbs->what_am_i); | 49 | hbs->what_am_i); |
50 | } | 50 | } |
51 | 51 | ||
@@ -65,11 +65,13 @@ hello_world_birth_traits (void *cls, | |||
65 | unsigned int index) | 65 | unsigned int index) |
66 | { | 66 | { |
67 | struct HelloWorldBirthState *hbs = cls; | 67 | struct HelloWorldBirthState *hbs = cls; |
68 | const char *what_am_i = hbs->what_am_i; | ||
69 | |||
68 | struct GNUNET_TESTING_Trait traits[] = { | 70 | struct GNUNET_TESTING_Trait traits[] = { |
69 | { | 71 | { |
70 | .index = 0, | 72 | .index = 0, |
71 | .trait_name = "what_am_i", | 73 | .trait_name = "what_am_i", |
72 | .ptr = (const void *) hbs->what_am_i, | 74 | .ptr = (const void *) what_am_i, |
73 | }, | 75 | }, |
74 | GNUNET_TESTING_trait_end () | 76 | GNUNET_TESTING_trait_end () |
75 | }; | 77 | }; |
@@ -100,16 +102,17 @@ hello_world_birth_run (void *cls, | |||
100 | 102 | ||
101 | if (0 == relativ.rel_value_us % 10) | 103 | if (0 == relativ.rel_value_us % 10) |
102 | { | 104 | { |
103 | hbs->what_am_i = "Hello World, I am a creature!"; | 105 | hbs->what_am_i = "creature!"; |
104 | } | 106 | } |
105 | else if (0 == relativ.rel_value_us % 2) | 107 | else if (0 == relativ.rel_value_us % 2) |
106 | { | 108 | { |
107 | hbs->what_am_i = "Hello World, I am a girl!"; | 109 | hbs->what_am_i = "girl!"; |
108 | } | 110 | } |
109 | else | 111 | else |
110 | { | 112 | { |
111 | hbs->what_am_i = "Hello World, I am a boy!"; | 113 | hbs->what_am_i = "boy!"; |
112 | } | 114 | } |
115 | GNUNET_TESTING_interpreter_next (is); | ||
113 | } | 116 | } |
114 | 117 | ||
115 | /** | 118 | /** |
@@ -122,9 +125,8 @@ hello_world_birth_run (void *cls, | |||
122 | * @return #GNUNET_OK on success. | 125 | * @return #GNUNET_OK on success. |
123 | */ | 126 | */ |
124 | int | 127 | int |
125 | GNUNET_TESTING_get_trait_what_am_i (const struct | 128 | GNUNET_TESTING_get_trait_what_am_i (const struct GNUNET_TESTING_Command *cmd, |
126 | GNUNET_TESTING_Command *cmd, | 129 | char **what_am_i) |
127 | char *what_am_i) | ||
128 | { | 130 | { |
129 | return cmd->traits (cmd->cls, | 131 | return cmd->traits (cmd->cls, |
130 | (const void **) what_am_i, | 132 | (const void **) what_am_i, |