Skip to content

Commit 2dd0b4f

Browse files
kartbenhenrikbrixandersen
authored andcommitted
tests: drivers: gnss: add test for get_fix_rate()
Add a test for this previously untested function Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
1 parent 64446d2 commit 2dd0b4f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/drivers/gnss/gnss_api/src/test_fix_rate.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,21 @@ static bool test_set_fix_rate(const struct test_config *config)
6464
return true;
6565
}
6666

67+
static bool test_get_fix_rate(const struct test_config *config)
68+
{
69+
int ret;
70+
uint32_t fix_interval;
71+
72+
ret = gnss_get_fix_rate(dev, &fix_interval);
73+
74+
if (ret == -ENOSYS) {
75+
ztest_test_skip();
76+
}
77+
zassert_ok(ret, "failed to get fix rate");
78+
zassert_equal(fix_interval, config->fix_interval, "fix_rate mismatch");
79+
return true;
80+
}
81+
6782
static void test_validate_fix_rate(const struct test_config *config)
6883
{
6984
bool valid;
@@ -83,6 +98,9 @@ ZTEST(gnss_api, test_fix_rate)
8398
if (!test_set_fix_rate(&configs[i])) {
8499
continue;
85100
}
101+
if (!test_get_fix_rate(&configs[i])) {
102+
continue;
103+
}
86104
test_validate_fix_rate(&configs[i]);
87105
}
88106
}

0 commit comments

Comments
 (0)