/* Unit tests for the rsp-low.c file.
- Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ Copyright (C) 2017-2019 Free Software Foundation, Inc.
This file is part of GDB.
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "selftest.h"
-#include "common/rsp-low.h"
+#include "gdbsupport/selftest.h"
+#include "gdbsupport/rsp-low.h"
namespace selftests {
namespace rsp_low {
SELF_CHECK (bv[1] == 0x23);
}
+static void test_hex2str ()
+{
+ SELF_CHECK (hex2str ("666f6f") == "foo");
+ SELF_CHECK (hex2str ("666f6fa") == "foo");
+ SELF_CHECK (hex2str ("666f6f", 2) == "fo");
+ SELF_CHECK (hex2str ("666", 2) == "f");
+ SELF_CHECK (hex2str ("666", 6) == "f");
+ SELF_CHECK (hex2str ("") == "");
+}
+
} /* namespace rsp_low */
} /* namespace selftests */
{
selftests::register_test ("hex2bin_byte_vector",
selftests::rsp_low::test_hex2bin_byte_vector);
+ selftests::register_test ("hex2str",
+ selftests::rsp_low::test_hex2str);
}