<commit_before>#include <boost/test/unit_test.hpp>
#include <envire_maps/Grid.hpp>

using namespace envire::maps;

BOOST_AUTO_TEST_CASE(test_grid_index)
{
    // check default constructor
    Index index;
    BOOST_CHECK_EQUAL(index.x(), 0);
    BOOST_CHECK_EQUAL(index.y(), 0);

    // check constructor with parameter
    Index index2(2, 4);
    BOOST_CHECK_EQUAL(index2.x(), 2);
    BOOST_CHECK_EQUAL(index2.y(), 4);         

    // check the "<" operator
    BOOST_CHECK_EQUAL((index2 < Index(index2.x() + 1, index2.y() + 1)), true);  
    BOOST_CHECK_EQUAL((index2 < Index(index2.x(), index2.y())), false);       
    BOOST_CHECK_EQUAL((index2 < Index(index2.x(), index2.y() + 1)), true);    
    BOOST_CHECK_EQUAL((index2 < Index(index2.x(), index2.y() - 1)), false); 
    BOOST_CHECK_EQUAL((index2 < Index(index2.x() - 1, index2.y() + 1)), false);     
    BOOST_CHECK_EQUAL((index2 < Index(index2.x() - 1, index2.y() - 1)), false);   

    // check the "<" operator
    BOOST_CHECK_EQUAL((index2 > Index(index2.x() - 1, index2.y() - 1)), true);  
    BOOST_CHECK_EQUAL((index2 > Index(index2.x(), index2.y())), false);       
    BOOST_CHECK_EQUAL((index2 > Index(index2.x(), index2.y() - 1)), true);    
    BOOST_CHECK_EQUAL((index2 > Index(index2.x(), index2.y() + 1)), false); 
    BOOST_CHECK_EQUAL((index2 > Index(index2.x() + 1, index2.y() - 1)), false);     
    BOOST_CHECK_EQUAL((index2 > Index(index2.x() + 1, index2.y() + 1)), false);        

    // check the "==" operator
    BOOST_CHECK_EQUAL((index2 == Index(index2.x(), index2.y())), true);
    BOOST_CHECK_EQUAL((index2 == Index(index2.x(), index2.y() + 1)), false);        
    BOOST_CHECK_EQUAL((index2 == Index(index2.x() + 1, index2.y())), false);    
    BOOST_CHECK_EQUAL((index2 == Index(index2.x() + 1, index2.y() + 1)), false);    

    // check the "!=" operator
    BOOST_CHECK_EQUAL((index2 != Index(index2.x(), index2.y())), false);
    BOOST_CHECK_EQUAL((index2 != Index(index2.x(), index2.y() + 1)), true);     
    BOOST_CHECK_EQUAL((index2 != Index(index2.x() + 1, index2.y())), true); 
    BOOST_CHECK_EQUAL((index2 != Index(index2.x() + 1, index2.y() + 1)), true);     

    // check the sum operator
    BOOST_CHECK((index2 + Index(3, 5)) == Index(5, 9));     

    BOOST_CHECK((Index(5, 9) - index2) == Index(3, 5));  

    // Implement!
    //BOOST_CHECK((index2 - Index(5, 9)) == Index(3, 5));  
}

BOOST_AUTO_TEST_CASE(test_grid_empty)
{
    Grid grid(Eigen::Vector2d(0.1, 0.1), Vector2ui(100, 100));
}<commit_msg>add tests for Index copy constructor<commit_after>#include <boost/test/unit_test.hpp>
#include <envire_maps/Grid.hpp>

using namespace envire::maps;

BOOST_AUTO_TEST_CASE(test_grid_index)
{
    // check default constructor
    Index index;
    BOOST_CHECK_EQUAL(index.x(), 0);
    BOOST_CHECK_EQUAL(index.y(), 0);

    // check constructor with parameter
    Index index2(2, 4);
    BOOST_CHECK_EQUAL(index2.x(), 2);
    BOOST_CHECK_EQUAL(index2.y(), 4);         

    // check the "<" operator
    BOOST_CHECK_EQUAL((index2 < Index(index2.x() + 1, index2.y() + 1)), true);  
    BOOST_CHECK_EQUAL((index2 < Index(index2.x(), index2.y())), false);       
    BOOST_CHECK_EQUAL((index2 < Index(index2.x(), index2.y() + 1)), true);    
    BOOST_CHECK_EQUAL((index2 < Index(index2.x(), index2.y() - 1)), false); 
    BOOST_CHECK_EQUAL((index2 < Index(index2.x() - 1, index2.y() + 1)), false);     
    BOOST_CHECK_EQUAL((index2 < Index(index2.x() - 1, index2.y() - 1)), false);   

    // check the ">" operator
    BOOST_CHECK_EQUAL((index2 > Index(index2.x() - 1, index2.y() - 1)), true);  
    BOOST_CHECK_EQUAL((index2 > Index(index2.x(), index2.y())), false);       
    BOOST_CHECK_EQUAL((index2 > Index(index2.x(), index2.y() - 1)), true);    
    BOOST_CHECK_EQUAL((index2 > Index(index2.x(), index2.y() + 1)), false); 
    BOOST_CHECK_EQUAL((index2 > Index(index2.x() + 1, index2.y() - 1)), false);     
    BOOST_CHECK_EQUAL((index2 > Index(index2.x() + 1, index2.y() + 1)), false);        

    // check the "==" operator
    BOOST_CHECK_EQUAL((index2 == Index(index2.x(), index2.y())), true);
    BOOST_CHECK_EQUAL((index2 == Index(index2.x(), index2.y() + 1)), false);        
    BOOST_CHECK_EQUAL((index2 == Index(index2.x() + 1, index2.y())), false);    
    BOOST_CHECK_EQUAL((index2 == Index(index2.x() + 1, index2.y() + 1)), false);    

    // check the "!=" operator
    BOOST_CHECK_EQUAL((index2 != Index(index2.x(), index2.y())), false);
    BOOST_CHECK_EQUAL((index2 != Index(index2.x(), index2.y() + 1)), true);     
    BOOST_CHECK_EQUAL((index2 != Index(index2.x() + 1, index2.y())), true); 
    BOOST_CHECK_EQUAL((index2 != Index(index2.x() + 1, index2.y() + 1)), true);     

    // check the sum operator
    BOOST_CHECK((index2 + Index(3, 5)) == Index(5, 9));     

    BOOST_CHECK((Index(5, 9) - index2) == Index(3, 5));  

    // Implement!
    //BOOST_CHECK((index2 - Index(5, 9)) == Index(3, 5)); 

    Index index3(Eigen::Matrix<unsigned int, 2, 1>(3, 4));
    BOOST_CHECK_EQUAL(index3.x(), 3);
    BOOST_CHECK_EQUAL(index3.y(), 4);
}

BOOST_AUTO_TEST_CASE(test_grid_empty)
{
    Grid grid(Eigen::Vector2d(0.1, 0.1), Vector2ui(100, 100));
}
{'fraction_non_alphanumeric': 0.1973025048169557, 'fraction_numerical': 0.04797687861271676, 'mean_word_length': 3.4291808873720138, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5352043', 'n_tokens_mistral': 2044, 'n_tokens_neox': 1877, 'n_words': 355}