projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean-up: lttng: utils: coding style fix
[lttng-tools.git]
/
tests
/
unit
/
ini_config
/
ini_config.cpp
diff --git
a/tests/unit/ini_config/ini_config.cpp
b/tests/unit/ini_config/ini_config.cpp
index c2a753edece66593a336529a21a2bde8c0eca677..4cc22119b63e3148881beebfde86a78ecab21df8 100644
(file)
--- a/
tests/unit/ini_config/ini_config.cpp
+++ b/
tests/unit/ini_config/ini_config.cpp
@@
-5,12
+5,16
@@
*
*/
*
*/
-#include <
tap/tap.h
>
-#include <common/
ini-config/ini-config.h
>
-#include <common/utils.h>
-#include <string.h>
+#include <
common/ini-config/ini-config.hpp
>
+#include <common/
path.hpp
>
+#include <common/utils.h
pp
>
+
#include <lttng/constant.h>
#include <lttng/constant.h>
+#include <string.h>
+#include <tap/tap.h>
+
+namespace {
struct state {
int section_1;
int section_2;
struct state {
int section_1;
int section_2;
@@
-19,6
+23,7
@@
struct state {
int text_entry;
int int_entry;
};
int text_entry;
int int_entry;
};
+} /* namespace */
int lttng_opt_quiet = 1;
int lttng_opt_verbose = 0;
int lttng_opt_quiet = 1;
int lttng_opt_verbose = 0;
@@
-35,8
+40,7
@@
static int entry_handler(const struct config_entry *entry, struct state *state)
if (!strcmp(entry->section, "section1")) {
state->section_1 = 1;
if (!strcmp(entry->section, "section1")) {
state->section_1 = 1;
- if (!strcmp(entry->name, "section1_entry") &&
- !strcmp(entry->value, "42")) {
+ if (!strcmp(entry->name, "section1_entry") && !strcmp(entry->value, "42")) {
state->int_entry = 1;
}
}
state->int_entry = 1;
}
}
@@
-48,7
+52,7
@@
static int entry_handler(const struct config_entry *entry, struct state *state)
if (!strcmp(entry->section, "section 3")) {
state->section_3 = 1;
if (!strcmp(entry->name, "name with a space") &&
if (!strcmp(entry->section, "section 3")) {
state->section_3 = 1;
if (!strcmp(entry->name, "name with a space") &&
-
!strcmp(entry->value, "another value")) {
+ !strcmp(entry->value, "another value")) {
state->text_entry = 1;
}
}
state->text_entry = 1;
}
}
@@
-62,7
+66,7
@@
end:
int main(int argc, char **argv)
{
int main(int argc, char **argv)
{
- char *path =
NULL
;
+ char *path =
nullptr
;
int ret;
struct state state = {};
int ret;
struct state state = {};
@@
-73,7
+77,7
@@
int main(int argc, char **argv)
if (strlen(argv[1]) >= LTTNG_PATH_MAX) {
diag("The provided path exceeds the maximal permitted length of %i bytes",
if (strlen(argv[1]) >= LTTNG_PATH_MAX) {
diag("The provided path exceeds the maximal permitted length of %i bytes",
-
LTTNG_PATH_MAX);
+ LTTNG_PATH_MAX);
goto end;
}
path = utils_expand_path(argv[1]);
goto end;
}
path = utils_expand_path(argv[1]);
@@
-82,27
+86,26
@@
int main(int argc, char **argv)
}
plan_no_plan();
}
plan_no_plan();
- ret = config_get_section_entries(
path, NULL,
-
(config_entry_handler_cb)
entry_handler, &state);
+ ret = config_get_section_entries(
+
path, nullptr, (config_entry_handler_cb)
entry_handler, &state);
ok(ret == 0, "Successfully opened a config file, registered to all sections");
ok(ret == 0, "Successfully opened a config file, registered to all sections");
- ok(state.section_1 && state.section_2 && state.section_3 &&
-
state.section_global,
"Processed entries from each sections");
+ ok(state.section_1 && state.section_2 && state.section_3 &&
state.section_global,
+ "Processed entries from each sections");
ok(state.text_entry, "Text value parsed correctly");
memset(&state, 0, sizeof(struct state));
ok(state.text_entry, "Text value parsed correctly");
memset(&state, 0, sizeof(struct state));
- ret = config_get_section_entries(
path, "section1",
-
(config_entry_handler_cb)
entry_handler, &state);
+ ret = config_get_section_entries(
+
path, "section1", (config_entry_handler_cb)
entry_handler, &state);
ok(ret == 0, "Successfully opened a config file, registered to one section");
ok(ret == 0, "Successfully opened a config file, registered to one section");
- ok(state.section_1 && !state.section_2 && !state.section_3 &&
-
!state.section_global,
"Processed an entry from section1 only");
+ ok(state.section_1 && !state.section_2 && !state.section_3 &&
!state.section_global,
+ "Processed an entry from section1 only");
ok(state.int_entry, "Int value parsed correctly");
memset(&state, 0, sizeof(struct state));
ok(state.int_entry, "Int value parsed correctly");
memset(&state, 0, sizeof(struct state));
- ret = config_get_section_entries(path, "",
- (config_entry_handler_cb)entry_handler, &state);
+ ret = config_get_section_entries(path, "", (config_entry_handler_cb) entry_handler, &state);
ok(ret == 0, "Successfully opened a config file, registered to the global section");
ok(ret == 0, "Successfully opened a config file, registered to the global section");
- ok(!state.section_1 && !state.section_2 && !state.section_3 &&
-
state.section_global,
"Processed an entry from the global section only");
+ ok(!state.section_1 && !state.section_2 && !state.section_3 &&
state.section_global,
+ "Processed an entry from the global section only");
end:
free(path);
return exit_status();
end:
free(path);
return exit_status();
This page took
0.025321 seconds
and
4
git commands to generate.