Skip to content

Commit

Permalink
Added float test
Browse files Browse the repository at this point in the history
  • Loading branch information
juha-h committed Oct 18, 2024
1 parent 219d20e commit d98219f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ int test_conf(void)
static const char *cfg =
"string_val\trattarei\n"
"u32_val 42\n"
"i32_val -23\n";
"i32_val -23\n"
"float_val 1.5\n";
char str[256];
struct conf *conf;
struct pl pl;
uint32_t u32;
int32_t i32;
double fl;
int err;

err = conf_alloc_buf(&conf, (uint8_t *)cfg, strlen(cfg));
Expand All @@ -42,6 +44,10 @@ int test_conf(void)
TEST_ERR(err);
TEST_EQUALS(-23, i32);

err = conf_get_float(conf, "float_val", &fl);
TEST_ERR(err);
TEST_EQUALS(1.5, fl);

/* Non-existing parameters */
if (0 == conf_get(conf, "rattarei", &pl))
goto badmsg;
Expand Down

0 comments on commit d98219f

Please sign in to comment.