Пример #1
0
int main()
{
    printf( "EXCOK: start\n" );
    set_terminate( &no_handler );
    test_basics();
    test_scalars();
    init_class();
    test_class();
    test_cl_ptrs();
    test_passthru();
    test_rethrow();
    try {
        ++throws;
        set_unexpected( &unexp );
        test_unexpected();
    } catch( long l ) {
        ++catches;
        if( l != 675L ) {
            printf( "unexpected failure %l\n", l );
        }
    }
    if( throws != catches ) {
        printf( "catches != throws\n" );
    }
    set_terminate( &my_term );
    test_term();

    printf( "terminate did not abort\n" );
    return( 0 );
}
Пример #2
0
void test_vector(void)
{
  auto sum_the_ints = [](int a, int i) -> int { return a + i; };
  auto sum_the_squares = [](int a, int i) -> int { return a + i*i; };

  int some_ints[] = { 1, 2, 3, 4, 5 };
  mtr::vector<int> integers(some_ints, 5);
  auto array = integers.append(6);
  int sum = array.foreach(0)(sum_the_ints);
  int sum_of_squares = array.foreach(0)(sum_the_squares);
  std::cout << "array count: " << array.length() << ", " << sum << ", " << sum_of_squares << std::endl;

  mtr::vector<test_class> v1;
  auto v2 = v1.append(test_class());
  auto v3 = v2.append(test_class());
  printf("All done with test_vector.\n");
}
Пример #3
0
int main(int argc, char** argv) {
    test_host_bits();
    test_class();
    test_mask();
    test_broadcast();
    test_is_valid_id();

    return 0;
}
Пример #4
0
 int test(nrex_search* s, int pos) const
 {
     if (s->end == pos)
     {
         return -1;
     }
     if (!test_class(s->at(pos)))
     {
         return -1;
     }
     return next ? next->test(s, pos + 1) : pos + 1;
 }
Пример #5
0
int main()
{
    test_integral();
    test_floating_point();
    test_nullptr_t();
    test_pointer();
    test_member_pointer();
    test_enum();
    test_class();

    return boost::report_errors();
}
Пример #6
0
int test_functions(void) {
  int retval = 0;

  retval |= test_settings();
  retval |= test_rounding();
  retval |= test_sticky();
  retval |= test_precision();
  retval |= test_class();
  retval |= test_mask();

  return retval;
}
Пример #7
0
test_class get_test_class() { return test_class(); }
Пример #8
0
int main(int argc, char **argv)
{
  for (size_t i = 0; i < 128; i++) {
    test_class(PN_OBJECT, i);
    test_class(PN_VOID, i);
    test_class(&noop_class, i);
  }

  for (size_t i = 0; i < 128; i++) {
    test_new(i, PN_OBJECT);
    test_new(i, &noop_class);
  }

  test_finalize();
  test_free();
  test_hashcode();
  test_compare();

  for (int i = 0; i < 1024; i++) {
    test_refcounting(i);
  }

  for (size_t i = 0; i < 4; i++) {
    test_list(i);
  }

  for (size_t i = 0; i < 4; i++) {
    test_list_refcount(i);
  }

  test_list_index();

  test_map();
  test_map_links();

  test_hash();

  test_string(NULL);
  test_string("");
  test_string("this is a test");
  test_string("012345678910111213151617181920212223242526272829303132333435363"
              "738394041424344454647484950515253545556575859606162636465666768");
  test_string("this has an embedded \000 in it");
  test_stringn("this has an embedded \000 in it", 28);

  test_string_format();
  test_string_addf();

  test_build_list();
  test_build_map();
  test_build_map_odd();

  for (int i = 0; i < 64; i++)
  {
    test_map_iteration(i);
  }

  test_list_inspect();
  test_map_inspect();
  test_list_compare();
  test_iterator();
  for (int seed = 0; seed < 64; seed++) {
    for (int size = 1; size <= 64; size++) {
      test_heap(seed, size);
    }
  }

  return 0;
}