From e9d3044d679c4b1059b9c1396cadf10ea1f3ce56 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Sun, 3 Mar 2024 12:17:48 +0100 Subject: [PATCH] test/conf: add conf_get_i32 --- test/conf.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/test/conf.c b/test/conf.c index 6ab431116..4437b7118 100644 --- a/test/conf.c +++ b/test/conf.c @@ -7,16 +7,22 @@ #include #include "test.h" +#define DEBUG_MODULE "test_conf" +#define DEBUG_LEVEL 5 +#include + int test_conf(void) { static const char *cfg = "string_val\trattarei\n" - "u32_val 42\n"; + "u32_val 42\n" + "i32_val -23\n"; char str[256]; struct conf *conf; struct pl pl; uint32_t u32; + int32_t i32; int err; err = conf_alloc_buf(&conf, (uint8_t *)cfg, strlen(cfg)); @@ -24,14 +30,17 @@ int test_conf(void) return err; err = conf_get_str(conf, "string_val", str, sizeof(str)); - if (err) - goto out; + TEST_ERR(err); if (strcmp(str, "rattarei")) goto badmsg; err = conf_get_u32(conf, "u32_val", &u32); - if (u32 != 42) - goto badmsg; + TEST_ERR(err); + TEST_EQUALS(42, u32); + + err = conf_get_i32(conf, "i32_val", &i32); + TEST_ERR(err); + TEST_EQUALS(-23, i32); /* Non-existing parameters */ if (0 == conf_get(conf, "rattarei", &pl))