mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
nvs: add test for ESP_ERR_NVS_INVALID_LENGTH
This commit is contained in:
parent
c40bbc5c42
commit
17dd3e9ca0
@ -522,6 +522,14 @@ TEST_CASE("nvs api tests", "[nvs]")
|
||||
char buf[strlen(str) + 1];
|
||||
size_t buf_len = sizeof(buf);
|
||||
|
||||
size_t buf_len_needed;
|
||||
TEST_ESP_OK(nvs_get_str(handle_2, "key", NULL, &buf_len_needed));
|
||||
CHECK(buf_len_needed == buf_len);
|
||||
|
||||
size_t buf_len_short = buf_len - 1;
|
||||
TEST_ESP_ERR(ESP_ERR_NVS_INVALID_LENGTH, nvs_get_str(handle_2, "key", buf, &buf_len_short));
|
||||
CHECK(buf_len_short == buf_len);
|
||||
|
||||
TEST_ESP_OK(nvs_get_str(handle_2, "key", buf, &buf_len));
|
||||
|
||||
CHECK(0 == strcmp(buf, str));
|
||||
|
Loading…
Reference in New Issue
Block a user