<commit_before>#include <thrusttest/unittest.h>
#include <thrust/iterator/counting_iterator.h>

void TestCountingIteratorIncrement(void)
{
    thrust::experimental::counting_iterator<int> iter(0);

    ASSERT_EQUAL(*iter, 0);

    iter++;

    ASSERT_EQUAL(*iter, 1);
    
    iter++;
    iter++;
    
    ASSERT_EQUAL(*iter, 3);

    iter += 5;
    
    ASSERT_EQUAL(*iter, 8);

    iter -= 10;
    
    ASSERT_EQUAL(*iter, -2);
}
DECLARE_UNITTEST(TestCountingIteratorIncrement);

void TestCountingIteratorComparison(void)
{
    thrust::experimental::counting_iterator<int> iter1(0);
    thrust::experimental::counting_iterator<int> iter2(0);

    ASSERT_EQUAL(iter1 - iter2, 0);
    ASSERT_EQUAL(iter1 == iter2, true);

    iter1++;
    
    ASSERT_EQUAL(iter1 - iter2, 1);
    ASSERT_EQUAL(iter1 == iter2, false);
   
    iter2++;

    ASSERT_EQUAL(iter1 - iter2, 0);
    ASSERT_EQUAL(iter1 == iter2, true);
  
    iter1 += 100;
    iter2 += 100;

    ASSERT_EQUAL(iter1 - iter2, 0);
    ASSERT_EQUAL(iter1 == iter2, true);
}
DECLARE_UNITTEST(TestCountingIteratorComparison);


<commit_msg>Add TestCountingIteratorLowerBound and mark it as KNOWN_FAILURE<commit_after>#include <thrusttest/unittest.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/sort.h>
#include <thrust/binary_search.h>

void TestCountingIteratorIncrement(void)
{
    thrust::experimental::counting_iterator<int> iter(0);

    ASSERT_EQUAL(*iter, 0);

    iter++;

    ASSERT_EQUAL(*iter, 1);
    
    iter++;
    iter++;
    
    ASSERT_EQUAL(*iter, 3);

    iter += 5;
    
    ASSERT_EQUAL(*iter, 8);

    iter -= 10;
    
    ASSERT_EQUAL(*iter, -2);
}
DECLARE_UNITTEST(TestCountingIteratorIncrement);

void TestCountingIteratorComparison(void)
{
    thrust::experimental::counting_iterator<int> iter1(0);
    thrust::experimental::counting_iterator<int> iter2(0);

    ASSERT_EQUAL(iter1 - iter2, 0);
    ASSERT_EQUAL(iter1 == iter2, true);

    iter1++;
    
    ASSERT_EQUAL(iter1 - iter2, 1);
    ASSERT_EQUAL(iter1 == iter2, false);
   
    iter2++;

    ASSERT_EQUAL(iter1 - iter2, 0);
    ASSERT_EQUAL(iter1 == iter2, true);
  
    iter1 += 100;
    iter2 += 100;

    ASSERT_EQUAL(iter1 - iter2, 0);
    ASSERT_EQUAL(iter1 == iter2, true);
}
DECLARE_UNITTEST(TestCountingIteratorComparison);

void TestCountingIteratorLowerBound(void)
{
    KNOWN_FAILURE;
    //size_t n = 10000;
    //const size_t M = 100;

    //thrust::host_vector<unsigned int> h_data = thrusttest::random_integers<unsigned int>(n);
    //for(unsigned int i = 0; i < n; ++i)
    //  h_data[i] %= M;

    //thrust::sort(h_data.begin(), h_data.end());

    //thrust::device_vector<unsigned int> d_data = h_data;

    //thrust::experimental::counting_iterator<unsigned int> search_begin(0);
    //thrust::experimental::counting_iterator<unsigned int> search_end(M);


    //thrust::host_vector<unsigned int> h_result(M);
    //thrust::device_vector<unsigned int> d_result(M);


    //thrust::experimental::lower_bound(h_data.begin(), h_data.end(),
    //                                  search_begin, search_end,
    //                                  h_result.begin());

    //thrust::experimental::lower_bound(d_data.begin(), d_data.end(),
    //                                  search_begin, search_end,
    //                                  d_result.begin());

    //ASSERT_EQUAL(h_result, d_result);
}
DECLARE_UNITTEST(TestCountingIteratorLowerBound);


{'fraction_non_alphanumeric': 0.14015151515151514, 'fraction_numerical': 0.027972027972027972, 'mean_word_length': 3.2019583843329253, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5189792', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1142, 'n_words': 191}