diff options
Diffstat (limited to 'test/address/config_type.c')
-rw-r--r-- | test/address/config_type.c | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/test/address/config_type.c b/test/address/config_type.c index 749499a86..c4052cd8d 100644 --- a/test/address/config_type.c +++ b/test/address/config_type.c @@ -61,21 +61,21 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) const struct Address *VarApple = cs_subset_address(sub, "Apple"); const struct Address *VarBanana = cs_subset_address(sub, "Banana"); - TEST_MSG("Apple = '%s'\n", buf_string(VarApple->mailbox)); - TEST_MSG("Banana = '%s'\n", buf_string(VarBanana->mailbox)); + TEST_MSG("Apple = '%s'", buf_string(VarApple->mailbox)); + TEST_MSG("Banana = '%s'", buf_string(VarBanana->mailbox)); const char *apple_orig = "apple@example.com"; const char *banana_orig = "banana@example.com"; if (!TEST_CHECK_STR_EQ(buf_string(VarApple->mailbox), apple_orig)) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } if (!TEST_CHECK_STR_EQ(buf_string(VarBanana->mailbox), banana_orig)) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } @@ -93,39 +93,39 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), apple_orig)) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } - TEST_MSG("Apple = '%s'\n", VarApple->mailbox); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = '%s'", VarApple->mailbox); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), banana_orig)) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } - TEST_MSG("Banana = '%s'\n", VarBanana ? buf_string(VarBanana->mailbox) : ""); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = '%s'", VarBanana ? buf_string(VarBanana->mailbox) : ""); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "john@doe.com", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -133,7 +133,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_set(cs, "Cherry", "jane@doe.com", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -141,13 +141,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } const struct Address *VarCherry = cs_subset_address(sub, "Cherry"); - TEST_MSG("Cherry = '%s'\n", VarCherry ? buf_string(VarCherry->mailbox) : ""); - TEST_MSG("Cherry's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Cherry = '%s'", VarCherry ? buf_string(VarCherry->mailbox) : ""); + TEST_MSG("Cherry's initial value is '%s'", NONULL(buf_string(value))); buf_pool_release(&value); log_line(__func__); @@ -171,7 +171,7 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -179,10 +179,10 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) addr = VarDamson ? VarDamson->mailbox : NULL; if (!TEST_CHECK_STR_EQ(buf_string(addr), valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, buf_string(addr), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, buf_string(addr), NONULL(valid[i])); } name = "Elderberry"; @@ -192,7 +192,7 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -200,10 +200,10 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) addr = VarElderberry ? VarElderberry->mailbox : NULL; if (!TEST_CHECK_STR_EQ(buf_string(addr), valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, buf_string(addr), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, buf_string(addr), NONULL(valid[i])); } log_line(__func__); @@ -221,24 +221,24 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const struct Address *VarFig = cs_subset_address(sub, "Fig"); addr = VarFig ? VarFig->mailbox : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, buf_string(addr), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, buf_string(addr), buf_string(err)); name = "Guava"; buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const struct Address *VarGuava = cs_subset_address(sub, "Guava"); addr = VarGuava ? VarGuava->mailbox : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, buf_string(addr), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, buf_string(addr), buf_string(err)); name = "Hawthorn"; rc = cs_str_string_set(cs, name, "hawthorn", err); @@ -249,12 +249,12 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const struct Address *VarHawthorn = cs_subset_address(sub, "Hawthorn"); addr = VarHawthorn ? VarHawthorn->mailbox : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, buf_string(addr), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, buf_string(addr), buf_string(err)); log_line(__func__); return true; @@ -274,7 +274,7 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_native_set(cs, name, (intptr_t) a, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tbns_out; } @@ -282,28 +282,28 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) addr = VarIlama ? VarIlama->mailbox : NULL; if (!TEST_CHECK_STR_EQ(buf_string(addr), buf_string(a->mailbox))) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); goto tbns_out; } - TEST_MSG("%s = '%s', set by '%s'\n", name, buf_string(addr), buf_string(a->mailbox)); + TEST_MSG("%s = '%s', set by '%s'", name, buf_string(addr), buf_string(a->mailbox)); name = "Jackfruit"; buf_reset(err); rc = cs_str_native_set(cs, name, 0, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tbns_out; } const struct Address *VarJackfruit = cs_subset_address(sub, "Jackfruit"); if (!TEST_CHECK(VarJackfruit == NULL)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); goto tbns_out; } addr = VarJackfruit ? VarJackfruit->mailbox : NULL; - TEST_MSG("%s = '%s', set by NULL\n", name, buf_string(addr)); + TEST_MSG("%s = '%s', set by NULL", name, buf_string(addr)); log_line(__func__); result = true; @@ -328,12 +328,12 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) const struct Address *VarKumquat = cs_subset_address(sub, "Kumquat"); if (!TEST_CHECK(VarKumquat == a)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } struct Buffer *addr1 = VarKumquat ? VarKumquat->mailbox : NULL; struct Buffer *addr2 = a ? a->mailbox : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, buf_string(addr1), buf_string(addr2)); + TEST_MSG("%s = '%s', '%s'", name, buf_string(addr1), buf_string(addr2)); log_line(__func__); return true; @@ -350,18 +350,18 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) const struct Address *VarLemon = cs_subset_address(sub, "Lemon"); struct Buffer *addr = VarLemon ? VarLemon->mailbox : NULL; - TEST_MSG("Initial: %s = '%s'\n", name, buf_string(addr)); + TEST_MSG("Initial: %s = '%s'", name, buf_string(addr)); int rc = cs_str_string_set(cs, name, "hello@example.com", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarLemon = cs_subset_address(sub, "Lemon"); addr = VarLemon ? VarLemon->mailbox : NULL; - TEST_MSG("Set: %s = '%s'\n", name, buf_string(addr)); + TEST_MSG("Set: %s = '%s'", name, buf_string(addr)); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -369,44 +369,44 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) addr = VarLemon ? VarLemon->mailbox : NULL; if (!TEST_CHECK_STR_EQ(buf_string(addr), "lemon@example.com")) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, buf_string(addr)); + TEST_MSG("Reset: %s = '%s'", name, buf_string(addr)); name = "Mango"; buf_reset(err); const struct Address *VarMango = cs_subset_address(sub, "Mango"); - TEST_MSG("Initial: %s = '%s'\n", name, buf_string(VarMango->mailbox)); + TEST_MSG("Initial: %s = '%s'", name, buf_string(VarMango->mailbox)); dont_fail = true; rc = cs_str_string_set(cs, name, "john@example.com", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarMango = cs_subset_address(sub, "Mango"); - TEST_MSG("Set: %s = '%s'\n", name, buf_string(VarMango->mailbox)); + TEST_MSG("Set: %s = '%s'", name, buf_string(VarMango->mailbox)); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarMango = cs_subset_address(sub, "Mango"); if (!TEST_CHECK_STR_EQ(buf_string(VarMango->mailbox), "john@example.com")) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, buf_string(VarMango->mailbox)); + TEST_MSG("Reset: %s = '%s'", name, buf_string(VarMango->mailbox)); log_line(__func__); return true; @@ -426,93 +426,93 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "hello@example.com", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Address *VarNectarine = cs_subset_address(sub, "Nectarine"); addr = VarNectarine ? VarNectarine->mailbox : NULL; - TEST_MSG("Address: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Address: %s = %s", name, buf_string(addr)); buf_reset(err); rc = cs_str_native_set(cs, name, IP a, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarNectarine = cs_subset_address(sub, "Nectarine"); addr = VarNectarine ? VarNectarine->mailbox : NULL; - TEST_MSG("Native: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Native: %s = %s", name, buf_string(addr)); name = "Olive"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello@example.com", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Address *VarOlive = cs_subset_address(sub, "Olive"); addr = VarOlive ? VarOlive->mailbox : NULL; - TEST_MSG("Address: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Address: %s = %s", name, buf_string(addr)); buf_reset(err); rc = cs_str_native_set(cs, name, IP a, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarOlive = cs_subset_address(sub, "Olive"); addr = VarOlive ? VarOlive->mailbox : NULL; - TEST_MSG("Native: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Native: %s = %s", name, buf_string(addr)); name = "Papaya"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello@example.com", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Address *VarPapaya = cs_subset_address(sub, "Papaya"); addr = VarPapaya ? VarPapaya->mailbox : NULL; - TEST_MSG("Address: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Address: %s = %s", name, buf_string(addr)); buf_reset(err); rc = cs_str_native_set(cs, name, IP a, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarPapaya = cs_subset_address(sub, "Papaya"); addr = VarPapaya ? VarPapaya->mailbox : NULL; - TEST_MSG("Native: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Native: %s = %s", name, buf_string(addr)); result = true; tv_out: @@ -532,8 +532,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch struct Buffer *pstr = pa ? pa->mailbox : NULL; struct Buffer *cstr = ca ? ca->mailbox : NULL; - TEST_MSG("%15s = %s\n", parent, buf_string(pstr)); - TEST_MSG("%15s = %s\n", child, buf_string(cstr)); + TEST_MSG("%15s = %s", parent, buf_string(pstr)); + TEST_MSG("%15s = %s", child, buf_string(cstr)); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -553,7 +553,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -562,7 +562,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "hello@example.com", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -572,7 +572,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "world@example.com", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -582,7 +582,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -592,7 +592,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); |