Esempio n. 1
0
int main()
{
  printf ("Results of any_test:\n");
  
  try
  {  
    printf                 ("default construction\n");
    test_default_ctor      ();
    printf                 ("single argument construction\n");
    test_converting_ctor   ();
    printf                 ("copy construction\n");
    test_copy_ctor         ();
    printf                 ("copy assignment operator\n");
    test_copy_assign       ();
    printf                 ("converting assignment operator\n");
    test_converting_assign ();
    printf                 ("failed custom keyword cast\n");
    test_bad_cast          ();
    printf                 ("swap member function\n");
    test_swap              ();
    printf                 ("copying operations on a null\n");
    test_null_copying      ();
  }
  catch (std::exception& exception)
  {
    printf ("fail with exception: %s\n", exception.what ());
  }

  return 0;
}
Esempio n. 2
0
void
test_ctors (const T*, const char *tname)
{
    for (int i = 0; i != 2; ++i) {

        // exercise the respective ctor in the first iteration
        // and the copy ctor invoked an object constructed with
        // the same respective ctor as in the first iteration
        // then

        const bool test_copy_ctor = 0 < i;

        test_default_ctor ((T*)0, tname, test_copy_ctor);
        test_size_ctor ((T*)0, tname, test_copy_ctor);
        test_value_ctor ((T*)0, tname, test_copy_ctor);
        test_array_ctor ((T*)0, tname, test_copy_ctor);
    }
}
Esempio n. 3
0
static int
run_test (int /*argc*/, char* /*argv*/ [])
{
    test_default_ctor ();

    test_value_copy_ctor ();
    test_value_move_ctor ();

    test_homo_copy_ctor ();
    test_homo_move_ctor ();
    test_homo_copy_assign ();
    test_homo_move_assign ();

    test_hetero_copy_ctor ();
    test_hetero_move_ctor ();
    test_hetero_copy_assign ();
    test_hetero_move_assign ();

    test_alloc_ctors ();

    return 0;
}