Apply clang-format code style to all source files
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
#include "cconfig/cmd.h"
|
||||
#include "cconfig/cconfig-util.h"
|
||||
#include "cconfig/cmd.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
static void test_cmd()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
int argc = 6;
|
||||
char* argv[] = {"-P", "test=aaa", "-C", "asdf", "-P", "test2=123"};
|
||||
char *argv[] = {"-P", "test=aaa", "-C", "asdf", "-P", "test2=123"};
|
||||
char str[32];
|
||||
int32_t val;
|
||||
|
||||
@@ -21,7 +21,8 @@ static void test_cmd()
|
||||
|
||||
check_int_eq(config->nentries, 2);
|
||||
|
||||
check_bool_true(cconfig_util_get_str(config, "test", str, sizeof(str), "1"));
|
||||
check_bool_true(
|
||||
cconfig_util_get_str(config, "test", str, sizeof(str), "1"));
|
||||
check_str_eq(str, "aaa");
|
||||
|
||||
check_bool_true(cconfig_util_get_int(config, "test2", &val, 0));
|
||||
@@ -32,9 +33,9 @@ static void test_cmd()
|
||||
|
||||
static void test_cmd_absent_entries()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
int argc = 6;
|
||||
char* argv[] = {"-P", "test=aaa", "-C", "asdf", "-P", "test2=123"};
|
||||
char *argv[] = {"-P", "test=aaa", "-C", "asdf", "-P", "test2=123"};
|
||||
char str[32];
|
||||
int32_t val;
|
||||
|
||||
@@ -49,7 +50,8 @@ static void test_cmd_absent_entries()
|
||||
|
||||
check_int_eq(config->nentries, 1);
|
||||
|
||||
check_bool_true(cconfig_util_get_str(config, "test", str, sizeof(str), "1"));
|
||||
check_bool_true(
|
||||
cconfig_util_get_str(config, "test", str, sizeof(str), "1"));
|
||||
check_str_eq(str, "aaa");
|
||||
|
||||
check_bool_false(cconfig_util_get_int(config, "test2", &val, 0));
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
static void test_init()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
@@ -17,7 +17,7 @@ static void test_init()
|
||||
|
||||
static void test_get_empty()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
@@ -31,8 +31,8 @@ static void test_get_empty()
|
||||
|
||||
static void test_set_get_one_elem()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig_entry* entry;
|
||||
struct cconfig *config;
|
||||
struct cconfig_entry *entry;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
@@ -50,15 +50,15 @@ static void test_set_get_one_elem()
|
||||
|
||||
check_str_eq(entry->key, "test");
|
||||
check_str_eq(entry->value, "123");
|
||||
check_str_eq(entry->desc, "desc");
|
||||
check_str_eq(entry->desc, "desc");
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_one_elem2()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig_entry* entry;
|
||||
struct cconfig *config;
|
||||
struct cconfig_entry *entry;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
@@ -76,15 +76,15 @@ static void test_set_get_one_elem2()
|
||||
|
||||
check_str_eq(entry->key, "test");
|
||||
check_str_eq(entry->value, "123");
|
||||
check_str_eq(entry->desc, "");
|
||||
check_str_eq(entry->desc, "");
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_same_elem()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig_entry* entry;
|
||||
struct cconfig *config;
|
||||
struct cconfig_entry *entry;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
@@ -104,15 +104,15 @@ static void test_set_get_same_elem()
|
||||
|
||||
check_str_eq(entry->key, "test");
|
||||
check_str_eq(entry->value, "12345");
|
||||
check_str_eq(entry->desc, "aaa");
|
||||
check_str_eq(entry->desc, "aaa");
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_many_elem()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig_entry* entry;
|
||||
struct cconfig *config;
|
||||
struct cconfig_entry *entry;
|
||||
char key[16];
|
||||
|
||||
config = cconfig_init();
|
||||
@@ -140,7 +140,7 @@ static void test_set_get_many_elem()
|
||||
|
||||
check_str_eq(entry->key, key);
|
||||
check_str_eq(entry->value, "123");
|
||||
check_str_eq(entry->desc, "desc");
|
||||
check_str_eq(entry->desc, "desc");
|
||||
}
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
static void test_set_get_int()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
int32_t value;
|
||||
|
||||
config = cconfig_init();
|
||||
@@ -29,7 +29,7 @@ static void test_set_get_int()
|
||||
|
||||
static void test_get_int_na()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
int32_t value;
|
||||
|
||||
config = cconfig_init();
|
||||
@@ -45,7 +45,7 @@ static void test_get_int_na()
|
||||
|
||||
static void test_set_get_float()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
float value;
|
||||
|
||||
config = cconfig_init();
|
||||
@@ -67,7 +67,7 @@ static void test_set_get_float()
|
||||
|
||||
static void test_get_float_na()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
float value;
|
||||
|
||||
config = cconfig_init();
|
||||
@@ -83,7 +83,7 @@ static void test_get_float_na()
|
||||
|
||||
static void test_set_get_bool()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
bool value;
|
||||
|
||||
config = cconfig_init();
|
||||
@@ -105,7 +105,7 @@ static void test_set_get_bool()
|
||||
|
||||
static void test_get_bool_na()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
bool value;
|
||||
|
||||
config = cconfig_init();
|
||||
@@ -121,7 +121,7 @@ static void test_get_bool_na()
|
||||
|
||||
static void test_set_get_str()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
char value[1024];
|
||||
|
||||
config = cconfig_init();
|
||||
@@ -135,8 +135,8 @@ static void test_set_get_str()
|
||||
check_str_eq(config->entries[0].key, "test");
|
||||
check_str_eq(config->entries[0].desc, "desc");
|
||||
|
||||
check_bool_true(cconfig_util_get_str(config, "test", value, sizeof(value),
|
||||
"world hello"));
|
||||
check_bool_true(cconfig_util_get_str(
|
||||
config, "test", value, sizeof(value), "world hello"));
|
||||
check_str_eq(value, "hello world");
|
||||
|
||||
cconfig_finit(config);
|
||||
@@ -144,7 +144,7 @@ static void test_set_get_str()
|
||||
|
||||
static void test_get_str_na()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
char value[1024];
|
||||
|
||||
config = cconfig_init();
|
||||
@@ -152,8 +152,8 @@ static void test_get_str_na()
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
check_bool_false(cconfig_util_get_str(config, "test", value, sizeof(value),
|
||||
"world hello"));
|
||||
check_bool_false(cconfig_util_get_str(
|
||||
config, "test", value, sizeof(value), "world hello"));
|
||||
check_str_eq(value, "world hello");
|
||||
|
||||
cconfig_finit(config);
|
||||
@@ -161,7 +161,7 @@ static void test_get_str_na()
|
||||
|
||||
static void test_set_get_data()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
uint8_t value[1024];
|
||||
uint8_t value2[1024];
|
||||
uint8_t value_default[] = {0x00};
|
||||
@@ -181,8 +181,8 @@ static void test_set_get_data()
|
||||
check_str_eq(config->entries[0].key, "test");
|
||||
check_str_eq(config->entries[0].desc, "desc");
|
||||
|
||||
check_bool_true(cconfig_util_get_data(config, "test", value2, sizeof(value2),
|
||||
value_default));
|
||||
check_bool_true(cconfig_util_get_data(
|
||||
config, "test", value2, sizeof(value2), value_default));
|
||||
check_data_eq(value2, sizeof(value2), value, sizeof(value));
|
||||
|
||||
cconfig_finit(config);
|
||||
@@ -190,7 +190,7 @@ static void test_set_get_data()
|
||||
|
||||
static void test_get_data_na()
|
||||
{
|
||||
struct cconfig* config;
|
||||
struct cconfig *config;
|
||||
uint8_t value[1024];
|
||||
uint8_t value_default[] = {0x01};
|
||||
|
||||
@@ -199,8 +199,8 @@ static void test_get_data_na()
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
check_bool_false(cconfig_util_get_data(config, "test", value, sizeof(value),
|
||||
value_default));
|
||||
check_bool_false(cconfig_util_get_data(
|
||||
config, "test", value, sizeof(value), value_default));
|
||||
check_data_eq(value, 1, value_default, sizeof(value_default));
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
Reference in New Issue
Block a user