@@ -22,6 +22,7 @@ tlib_parallel_info_t parallel_info
22
22
static void test_wraprecs_hashmap () {
23
23
nruserfn_t * wraprec , * found_wraprec ;
24
24
zend_string * func_name , * scope_name , * method_name ;
25
+ bool is_new_wraprec = false;
25
26
26
27
func_name = zend_string_init (NR_PSTR (FUNCTION_NAME ), 0 );
27
28
scope_name = zend_string_init (NR_PSTR (SCOPE_NAME ), 0 );
@@ -32,26 +33,38 @@ static void test_wraprecs_hashmap() {
32
33
nr_php_user_instrument_wraprec_hashmap_destroy ();
33
34
34
35
// Test valid operations before initializing the hashmap
35
- wraprec = nr_php_user_instrument_wraprec_hashmap_add (NR_PSTR (FUNCTION_NAME ));
36
+ wraprec = nr_php_user_instrument_wraprec_hashmap_add (NR_PSTR (FUNCTION_NAME ),
37
+ & is_new_wraprec );
36
38
tlib_pass_if_null ("adding valid function before init" , wraprec );
37
- wraprec = nr_php_user_instrument_wraprec_hashmap_add (NR_PSTR (SCOPED_METHOD_NAME ));
39
+ tlib_pass_if_false ("adding valid function before init" , is_new_wraprec ,
40
+ "expected false for is_new_wraprec" );
41
+ wraprec = nr_php_user_instrument_wraprec_hashmap_add (NR_PSTR (SCOPED_METHOD_NAME ),
42
+ & is_new_wraprec );
38
43
tlib_pass_if_null ("adding valid method before init" , wraprec );
44
+ tlib_pass_if_false ("adding valid function before init" , is_new_wraprec ,
45
+ "expected false for is_new_wraprec" );
39
46
40
47
// Initialize the hashmap
41
48
nr_php_user_instrument_wraprec_hashmap_init ();
42
49
43
50
// Test valid operations after initializing the hashmap
44
- wraprec = nr_php_user_instrument_wraprec_hashmap_add (NR_PSTR (FUNCTION_NAME ));
51
+ wraprec = nr_php_user_instrument_wraprec_hashmap_add (NR_PSTR (FUNCTION_NAME ),
52
+ & is_new_wraprec );
45
53
tlib_pass_if_not_null ("adding valid global function" , wraprec );
54
+ tlib_pass_if_true ("adding valid global function" , is_new_wraprec ,
55
+ "expected true for is_new_wraprec" );
46
56
47
57
found_wraprec = nr_php_user_instrument_wraprec_hashmap_get (func_name , NULL );
48
58
tlib_pass_if_ptr_equal ("getting valid global function" , wraprec , found_wraprec );
49
59
50
60
found_wraprec = nr_php_user_instrument_wraprec_hashmap_get (func_name , scope_name );
51
61
tlib_pass_if_null ("getting global function with scope" , found_wraprec );
52
62
53
- wraprec = nr_php_user_instrument_wraprec_hashmap_add (NR_PSTR (SCOPED_METHOD_NAME ));
63
+ wraprec = nr_php_user_instrument_wraprec_hashmap_add (NR_PSTR (SCOPED_METHOD_NAME ),
64
+ & is_new_wraprec );
54
65
tlib_pass_if_not_null ("adding valid scoped method" , wraprec );
66
+ tlib_pass_if_true ("adding valid scoped function" , is_new_wraprec ,
67
+ "expected true for is_new_wraprec" );
55
68
56
69
found_wraprec = nr_php_user_instrument_wraprec_hashmap_get (method_name , scope_name );
57
70
tlib_pass_if_ptr_equal ("getting scoped method" , wraprec , found_wraprec );
0 commit comments