Rename common to gdbsupport
[deliverable/binutils-gdb.git] / gdb / unittests / rsp-low-selftests.c
index 74d106e9e608dd45330fe72a5e9b27d3ac66cdf3..e316a22c74c876d0743e83dd554b8f9bd3e191bc 100644 (file)
@@ -1,6 +1,6 @@
 /* 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.
 
@@ -18,8 +18,8 @@
    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 {
@@ -48,6 +48,16 @@ static void test_hex2bin_byte_vector ()
   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 */
 
@@ -56,4 +66,6 @@ _initialize_rsp_low_selftests ()
 {
   selftests::register_test ("hex2bin_byte_vector",
                            selftests::rsp_low::test_hex2bin_byte_vector);
+  selftests::register_test ("hex2str",
+                           selftests::rsp_low::test_hex2str);
 }
This page took 0.025458 seconds and 4 git commands to generate.