+#include <osmocore/utils.h>
+
+struct test_case {
+ const uint8_t *input;
+ const uint16_t input_length;
+
+ const uint8_t *expected;
+ const uint16_t expected_length;
+};
+
+static const char simple_text[] = "test text";
+static const uint8_t simple_enc[] = {
+ 0xf4, 0xf2, 0x9c, 0x0e, 0xa2, 0x97, 0xf1, 0x74
+};
+
+static const char escape_text[] = "!$ a more#^- complicated test@@?_\%! case";
+static const uint8_t escape_enc[] = {
+ 0x21, 0x01, 0x28, 0x0c, 0x6a, 0xbf, 0xe5, 0xe5, 0xd1,
+ 0x86, 0xd2, 0x02, 0x8d, 0xdf, 0x6d, 0x38, 0x3b, 0x3d,
+ 0x0e, 0xd3, 0xcb, 0x64, 0x10, 0xbd, 0x3c, 0xa7, 0x03,
+ 0x00, 0xbf, 0x48, 0x29, 0x04, 0x1a, 0x87, 0xe7, 0x65,
+};
+
+static const struct test_case test_encode[] =
+{
+ {
+ .input = simple_text,
+ .expected = simple_enc,
+ .expected_length = sizeof(simple_enc),
+ },
+ {
+ .input = escape_text,
+ .expected = escape_enc,
+ .expected_length = sizeof(escape_enc),
+ },
+};
+
+static const struct test_case test_decode[] =
+{
+ {
+ .input = simple_enc,
+ .input_length = sizeof(simple_enc),
+ .expected = simple_text,
+ },
+ {
+ .input = escape_enc,
+ .input_length = sizeof(escape_enc),
+ .expected = escape_text,
+ },
+};