diff --git a/tests/gumjs/script.c b/tests/gumjs/script.c index d0a13ce164..ec02f4a3e1 100644 --- a/tests/gumjs/script.c +++ b/tests/gumjs/script.c @@ -10,6 +10,8 @@ */ #include "script-fixture.c" +#include "gum/gummemory.h" + TESTLIST_BEGIN (script) TESTENTRY (invalid_script_should_return_null) @@ -116,6 +118,7 @@ TESTLIST_BEGIN (script) TESTENTRY (memory_can_be_allocated_with_page_granularity) TESTENTRY (memory_can_be_allocated_near_address) TESTENTRY (memory_can_be_copied) + TESTENTRY (read_from_valid_address_should_succeed) TESTENTRY (memory_can_be_duped) TESTENTRY (memory_can_be_protected) TESTENTRY (memory_protection_can_be_queried) @@ -11739,3 +11742,20 @@ target_function_nested_c (int arg) return result; } + +TESTCASE (read_from_valid_address_should_succeed) +{ + guint8 magic[2] = { 0x13, 0x37 }; + gsize n_bytes_read; + guint8 * result; + + result = gum_memory_read (magic, sizeof (magic), &n_bytes_read); + g_assert_nonnull (result); + + g_assert_cmpuint (n_bytes_read, ==, sizeof (magic)); + + g_assert_cmphex (result[0], ==, magic[0]); + g_assert_cmphex (result[1], ==, magic[1]); + + g_free (result); +} \ No newline at end of file