Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hillel.pinto_xmcyber authored and hillel.pinto_xmcyber committed May 27, 2024
1 parent f9b1123 commit 9ad0c88
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/gumjs/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*/

#include "script-fixture.c"
#include "gum/gummemory.h"


TESTLIST_BEGIN (script)
TESTENTRY (invalid_script_should_return_null)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}

0 comments on commit 9ad0c88

Please sign in to comment.