<commit_before>#include <gtest/gtest.h>
#include <sm/BoostPropertyTree.hpp>
#include <boost/property_tree/xml_parser.hpp>

TEST(PTreeTestSuite, testBoostPTree)
{

  sm::BoostPropertyTree wbpt;
  
  wbpt.setDouble("d",0.1);
  wbpt.setDouble("d/d",0.2);
  wbpt.setInt("i",1);
  wbpt.setInt("i/i",2);
  wbpt.setBool("b",true);
  wbpt.setBool("b/b", false);
  wbpt.setString("/s","hello");
  wbpt.setString("s/s","goodbye");
  wbpt.saveXml("test.xml");

  try 
    {
      sm::BoostPropertyTree pt;
      
      pt.loadXml("test.xml");
      
      ASSERT_NEAR(pt.getDouble("d"), 0.1, 1e-16);
      ASSERT_NEAR(pt.getDouble("/d"), 0.1, 1e-16);
      ASSERT_NEAR(pt.getDouble("d/d"), 0.2, 1e-16);
      ASSERT_NEAR(pt.getDouble("/d/d"), 0.2, 1e-16);
      // Push a namespace on to the stack.<commit_msg>Add unit test check to show problem with doesKeyExist() method<commit_after>#include <gtest/gtest.h>
#include <sm/BoostPropertyTree.hpp>
#include <boost/property_tree/xml_parser.hpp>

TEST(PTreeTestSuite, testBoostPTree)
{

  sm::BoostPropertyTree wbpt;
  
  wbpt.setDouble("d",0.1);
  wbpt.setDouble("d/d",0.2);
  wbpt.setInt("i",1);
  wbpt.setInt("i/i",2);
  wbpt.setBool("b",true);
  wbpt.setBool("b/b", false);
  wbpt.setString("/s","hello");
  wbpt.setString("s/s","goodbye");
  wbpt.saveXml("test.xml");

  EXPECT_TRUE(wbpt.doesKeyExist("d"));
  EXPECT_TRUE(wbpt.doesKeyExist("d/d"));
  EXPECT_TRUE(wbpt.doesKeyExist("i"));
  EXPECT_TRUE(wbpt.doesKeyExist("i/i"));
  EXPECT_TRUE(wbpt.doesKeyExist("b"));
  EXPECT_TRUE(wbpt.doesKeyExist("b/b"));
  EXPECT_TRUE(wbpt.doesKeyExist("s"));
  EXPECT_TRUE(wbpt.doesKeyExist("s/s"));
  EXPECT_FALSE(wbpt.doesKeyExist("xyz"));

  try 
    {
      sm::BoostPropertyTree pt;
      
      pt.loadXml("test.xml");
      
      ASSERT_NEAR(pt.getDouble("d"), 0.1, 1e-16);
      ASSERT_NEAR(pt.getDouble("/d"), 0.1, 1e-16);
      ASSERT_NEAR(pt.getDouble("d/d"), 0.2, 1e-16);
      ASSERT_NEAR(pt.getDouble("/d/d"), 0.2, 1e-16);
      // Push a namespace on to the stack.
{'fraction_non_alphanumeric': 0.20398009950248755, 'fraction_numerical': 0.025870646766169153, 'mean_word_length': 3.9168704156479217, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2493302', 'n_tokens_mistral': 893, 'n_tokens_neox': 849, 'n_words': 103}