1 /*
2  * Copyright (c) 2017-2020 Nordic Semiconductor ASA
3  * Copyright (c) 2015 Runtime Inc
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #include "fcb_test.h"
9 
ZTEST(fcb_test_with_2sectors_set,test_fcb_len)10 ZTEST(fcb_test_with_2sectors_set, test_fcb_len)
11 {
12 	uint8_t buf[3];
13 	uint16_t len;
14 	uint16_t len2;
15 	int rc;
16 	int rc2;
17 	struct fcb fcb = { .f_erase_value = fcb_test_erase_value };
18 
19 
20 
21 	for (len = 0U; len < FCB_MAX_LEN; len++) {
22 		rc = fcb_put_len(&fcb, buf, len);
23 		zassert_true(rc == 1 || rc == 2, "fcb_put_len call failure");
24 
25 		rc2 = fcb_get_len(&fcb, buf, &len2);
26 		zassert_true(rc2 == rc, "fcb_get_len call failure");
27 
28 		zassert_true(len == len2, "fcb_get_len call failure");
29 	}
30 }
31