net: lwm2m: Separate opaque content format into its own

Opaque content format is not part of clear-text, so it
should be separated into its own file.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This commit is contained in:
Seppo Takalo 2023-08-08 13:31:40 +03:00 committed by Carles Cufí
commit f227b56792
6 changed files with 196 additions and 75 deletions

View file

@ -470,37 +470,6 @@ ZTEST(net_content_plain_text_nodata, test_get_bool_nodata)
zassert_equal(ret, -ENODATA, "Invalid error code returned");
}
ZTEST(net_content_plain_text, test_get_opaque)
{
int ret;
const char *payload = "test_payload";
uint8_t buf[16];
bool last_block;
struct lwm2m_opaque_context ctx = { 0 };
test_payload_set(payload);
ret = plain_text_reader.get_opaque(&test_in, buf, sizeof(buf),
&ctx, &last_block);
zassert_equal(ret, strlen(payload), "Invalid length returned");
zassert_mem_equal(buf, payload, strlen(payload),
"Invalid value parsed");
zassert_equal(test_in.offset, strlen(payload) + 1,
"Invalid packet offset");
}
ZTEST(net_content_plain_text_nodata, test_get_opaque_nodata)
{
int ret;
uint8_t value[4];
bool last_block;
struct lwm2m_opaque_context ctx = { 0 };
ret = plain_text_reader.get_opaque(&test_in, value, sizeof(value),
&ctx, &last_block);
zassert_equal(ret, 0, "Invalid error code returned");
}
ZTEST(net_content_plain_text, test_get_objlnk)
{
int ret;