Example #1
0
void test_iterator_types ( const Container &c, Predicate comp, std::size_t offset ) {
    typedef std::vector<typename Container::value_type> vec;
    typedef forward_iterator<typename vec::iterator> FI;
    typedef bidirectional_iterator<typename vec::iterator> BDI;
    typedef random_access_iterator<typename vec::iterator> RAI;
    
    vec v;
    v.assign ( c.begin (), c.end ());
    test_iterators ( FI  ( v.begin ()), FI  ( v.end ()), comp, offset );
    v.assign ( c.begin (), c.end ());
    test_iterators ( BDI ( v.begin ()), BDI ( v.end ()), comp, offset );
    v.assign ( c.begin (), c.end ());
    test_iterators ( RAI ( v.begin ()), RAI ( v.end ()), comp, offset );
    }
Example #2
0
int main()
{
  test_basic();
  test_capacity();
  test_comparison();
  test_composite_key();
  test_conv_iterators();
  test_copy_assignment();
  test_hash_ops();
  test_iterators();
  test_key_extractors();
  test_list_ops();
  test_modifiers();
  test_mpl_ops();
  test_observers();
  test_projection();
  test_range();
  test_rank_ops();
  test_rearrange();
  test_safe_mode();
  test_serialization();
  test_set_ops();
  test_special_set_ops();
  test_update();

  return boost::report_errors();
}
Example #3
0
static void run_tests()
{
    test_misc();
    test_clear();
    test_update();
    test_conditional_updates();
    test_circular();
    test_set_nocheck();
    test_iterators();
    test_preserve_order();
    test_object_foreach();
}
Example #4
0
int main()
{
    test_misc();
    test_clear();
    test_update();
    test_circular();
    test_set_nocheck();
    test_iterators();
    test_preserve_order();

    return 0;
}
Example #5
0
int main ()
{
    BEGIN_TESTS(0);

    test_constructors();
    test_assignments();
    test_access();
    test_iterators();
    test_capacity();
    test_operations();
    test_search();

    return END_TESTS;
}
Example #6
0
void test_alignments(test_harness& t) {
    sam::alignment aln;

    t.check(sizeof aln, sizeof(void*), "aln.sizeof");

    sam::alignment a1(aln);
    sam::alignment a2 = aln;

    a2 = a1;

    a1.set_qname("JAS5_12:1:3");

    test_unpack_seq(t);
    test_iterators(t, a1);
    test_auxen(t);

    test_format(t);
}
Example #7
0
int main()
{
  test_iterators();
  return boost::report_errors();
}
Example #8
0
void test()
{
   intset s;
   printf("sizeof(set of int): %lu\n", (unsigned long)sizeof(s));
   assert(s.empty() == true);

   printf("insert()\n");
   assert(*(intset().insert(1).first) == 1);
   for (int i = 0; i <= 5; ++i)
      assert(s.insert(i).second == true);

   assert(s.insert(5).second == false); // unique keys
   assert(*s.insert(5).first == 5); // the blocking element

   assert(s.empty() == false);
   // assert(s.size() == 10);
   // assert(s.max_size() > s.size());
   assert(s.max_size() > 0);

   test_iterators(s);

   printf("comparing the values with std STL\n");
   {
      std::set<int> sstd;
      for (int i = 0; i <= 5; ++i)
      {
         std::pair<std::set<int>::iterator, bool> re = sstd.insert(i);
         assert(re.second == true);
         // test the behaviour expected from ttl::map
         re = sstd.insert(i);
         assert(*re.first == i);
         assert(re.second == false);
      }

      assert(ttl::equal(sstd.begin(), sstd.end(), s.cbegin()));

      std::set<int>::const_iterator istd = constify(sstd).begin();
      intset::const_iterator ittl = constify(s).begin();
      while (istd != sstd.end())
      {
         assert(*istd == *ittl);
         ++istd;
         ++ittl;
      }
   }

   for (int i = 6; i <= 9; ++i)
      assert(s.insert(i).second == true);

   assert(s.find(9) == constify(s).find(9));
   assert(*s.find(9) == 9);

   printf("erase(key)\n");
   intset().erase(0);
   assert(s.erase(9) == 1);
   assert(s.find(9) == s.end());

   printf("ranges\n");
   intset().lower_bound(0);
   intset().upper_bound(0);
   intset().equal_range(0);
   assert(*s.lower_bound(2) == 2);
   assert(*s.upper_bound(2) == 3);

   ttl::pair<intset::iterator, intset::iterator> range = s.equal_range(3);
   assert(range.first == s.lower_bound(3));
   assert(range.second == s.upper_bound(3));
   assert(*++range.first == 4);

   assert(s.equal_range(0).first == s.begin());
   assert(s.equal_range(8).second == s.end());

   printf("clear()\n");
   intset().clear();
   s.clear();

   printf("copy constructors and assignment operator\n");
   {
      ttl::array<int, 3> arr = { {100, 101, 102} };

      intset sa(arr.begin(), arr.end());
      assert(ttl::equal(sa.cbegin(), sa.cend(), arr.cbegin()));

      intset sb = sa;
      assert(ttl::equal(sb.cbegin(), sb.cend(), arr.cbegin()));
      assert(sa == sb);

      intset sc;
      sc = sb;
      assert(ttl::equal(sc.cbegin(), sc.cend(), arr.cbegin()));
      assert(!(sa != sc));

      for (intset::const_iterator it = sc.cbegin(); it != sc.cend(); ++it)
         printf(" {%d}", *it);
      printf("\n");
   }
   printf("range insert\n");
   {
      const ttl::array<int, 3> arr = { {10, 11, 12} };
      intset sa;
      sa.insert(arr.begin(), arr.end());
      assert(ttl::equal(sa.cbegin(), sa.cend(), arr.cbegin()));
      for (intset::const_iterator it = sa.cbegin(); it != sa.cend(); ++it)
         printf(" {%d}", *it);
      printf("\n");
   }
}
Example #9
0
File: hxxx.c Project: IAPark/vlc
static void test_annexb()
{
    const uint8_t *p_res[3];
    size_t rgi_res[3];

    /* Full mixed set */
    const uint8_t test1_annexbdata[] = { 0, 0, 0, 1, 0x55, 0x55, 0x55, 0x55, 0x55,
                                         0, 0, 1, 0x22, 0x22,
                                         0, 0, 0, 1, 0x11,
                                         0, 0, 1, 0x11,
                                         0, 0, 0, 1, 0x33, 0x33, 0x33, };
    const uint8_t test1_avcdata1[] = { 5, 0x55, 0x55, 0x55, 0x55, 0x55,
                                       2, 0x22, 0x22,
                                       1, 0x11,
                                       1, 0x11,
                                       3, 0x33, 0x33, 0x33, };
    const uint8_t test1_avcdata2[] = { 0, 5, 0x55, 0x55, 0x55, 0x55, 0x55,
                                       0, 2, 0x22, 0x22,
                                       0, 1, 0x11,
                                       0, 1, 0x11,
                                       0, 3, 0x33, 0x33, 0x33, };
    const uint8_t test1_avcdata4[] = { 0, 0, 0, 5, 0x55, 0x55, 0x55, 0x55, 0x55,
                                       0, 0, 0, 2, 0x22, 0x22,
                                       0, 0, 0, 1, 0x11,
                                       0, 0, 0, 1, 0x11,
                                       0, 0, 0, 3, 0x33, 0x33, 0x33, };

    /* single nal test */
    const uint8_t test2_annexbdata[] = { 0, 0, 0, 1, 0x55, 0x55, 0x55, 0x55, 0x55 };
    const uint8_t test2_avcdata1[]   = { 5, 0x55, 0x55, 0x55, 0x55, 0x55 };
    const uint8_t test2_avcdata2[]   = { 0, 5, 0x55, 0x55, 0x55, 0x55, 0x55 };
    const uint8_t test2_avcdata4[]   = { 0, 0, 0, 5, 0x55, 0x55, 0x55, 0x55, 0x55 };

    /* single nal test, startcode 3 */
    const uint8_t test3_annexbdata[] = { 0, 0, 1, 0x11 };
    const uint8_t test3_avcdata1[] =   { 1, 0x11 };
    const uint8_t test3_avcdata2[] =   { 0, 1, 0x11 };
    const uint8_t test3_avcdata4[] =   { 0, 0, 0, 1, 0x11 };

    /* empty nal test */
    const uint8_t test4_annexbdata[] = { 0, 0, 1 };
    const uint8_t test4_avcdata1[]   = { 0 };
    const uint8_t test4_avcdata2[]   = { 0, 0 };
    const uint8_t test4_avcdata4[]   = { 0, 0, 0, 0 };

    /* 4 bytes prefixed nal only (4 prefix optz) */
    const uint8_t test5_annexbdata[] = { 0, 0, 0, 1, 0x11, 0, 0, 0, 1, 0x22, 0x22 };
    const uint8_t test5_avcdata1[]   = { 1, 0x11, 2, 0x22, 0x22 };
    const uint8_t test5_avcdata2[]   = { 0, 1, 0x11, 0, 2, 0x22, 0x22 };
    const uint8_t test5_avcdata4[]   = { 0, 0, 0, 1, 0x11, 0, 0, 0, 2, 0x22, 0x22 };

    /* startcode repeat / empty nal */
    const uint8_t test6_annexbdata[] = { 0, 0, 1, 0x11, 0, 0, 1, 0, 0, 1 };
    const uint8_t test6_avcdata1[] =   { 1, 0x11, 0, 0 };
    const uint8_t test6_avcdata2[] =   { 0, 1, 0x11, 0, 0, 0, 0 };
    const uint8_t test6_avcdata4[] =   { 0, 0, 0, 1, 0x11, 0, 0, 0, 0, 0, 0, 0, 0 };

    /* empty nal variation test */
    const uint8_t test7_annexbdata[] = { 0, 0, 0, 1 };
    const uint8_t test7_avcdata1[]   = { 0 };
    const uint8_t test7_avcdata2[]   = { 0, 0 };
    const uint8_t test7_avcdata4[]   = { 0, 0, 0, 0 };

    runtest(4, "empty nal test", testannexbin);
    runtest(2, "single nal test", testannexbin);
    runtest(3, "single nal test, startcode 3", testannexbin);
    runtest(5, "4 bytes prefixed nal only (4 prefix optz)", testannexbin);
    runtest(1, "mixed nal set", testannexbin);
    runtest(6, "startcode repeat / empty nal", testannexbin);

    runtest(1, "IT mixed nal set", test_iterators);
    runtest(2, "IT single nal test", test_iterators);
    runtest(3, "IT single nal test, startcode 3", test_iterators);
    runtest(4, "IT empty nal test", test_iterators);
    runtest(5, "IT 4 bytes prefixed nal only (4 prefix optz)", test_iterators);
    runtest(6, "startcode repeat / empty nal", test_iterators);
    runtest(7, "IT empty nal", test_iterators);

    printf("\nTEST 8 borkage test\n");\
    rgi_res[0] = 0;
    rgi_res[1] = rgi_res[2] = 1;
    p_res[0] = NULL;
    p_res[1] = p_res[2] = test7_avcdata1;
    test_iterators( NULL, 0, p_res, rgi_res );
}