Need a conditional to test if title of parent page matches title of child page

solution here as function:

function testchildren () { 
   global $post; 
    $childtest = get_pages('child_of=".$post->ID); 
       if( count( $childtest ) != 0 ) { 
       return false; 
       } else { 
       return true; 
      } 
} 

and implementation as markup:

   <?php if (have_posts()) : while (have_posts()) : the_post() ; ?> 
       <h2><?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?> </h2>
    <?php if ( testchildren() ) : ?> 
        <h1 style="margin-top:6px; margin-bottom:12px;"><?php the_title(); ?></h1>
    <?php endif; ?>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>