Ejemplo 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;
}
Ejemplo n.º 2
0
int main (void) {

    // review the test_vectIO() code; this test assumes you
    // have the parameterized CTOR and operator[] working;
    test_vectIO();
	
	// ALL of these tests `assert' their expected values. Therefore, if
	// flow control gets to the output at the end of main(), all tests
	// have passed.
	
	test_element_access();		// test element access (operator[])
	test_copy_ctor();			// test copy constructor (try to change values in sub-func)
	//test_relational_ops();	// test relational ops (<,>,<=,>=,==,!=)
	//test_arithmatic_ops();	// test arithmatic ops (+,-)
	//test_dot_product();		// test dot product (operator*)
	//test_cross_product();		// test cross product (operator%)
	
	cout << "VECTOR CLASS PASSES ALL TESTS.\n";
	return 0;
}
Ejemplo n.º 3
0
        void main()
        {
            std::cout << "[:: Test 1: Call with no side effects. ::]" << std::endl;
            test_simple();

            std::cout << "[:: Test 2: Call with side effects. ::]" << std::endl;
            test_side_effects();

            std::cout << "[:: Test 3: Copy stuff. ::]" << std::endl;
            test_copy();

            std::cout << "[:: Test 4: Copy ctor stuff. ::]" << std::endl;
            test_copy_ctor();

            std::cout << "[:: Test 5: Move stuff. ::]" << std::endl;
            test_move();

            std::cout << "[:: Test 6: Move ctor stuff. ::]" << std::endl;
            test_move_ctor();
        }
Ejemplo n.º 4
0
DEF_TEST(TArray, reporter) {
    TestTSet_basic<true>(reporter);
    TestTSet_basic<false>(reporter);
    test_swap(reporter);

    test_copy_ctor(reporter, SkTArray<sk_sp<SkRefCnt>, false>());
    test_copy_ctor(reporter, SkTArray<sk_sp<SkRefCnt>,  true>());
    test_copy_ctor(reporter, SkSTArray< 1, sk_sp<SkRefCnt>, false>());
    test_copy_ctor(reporter, SkSTArray< 1, sk_sp<SkRefCnt>,  true>());
    test_copy_ctor(reporter, SkSTArray<10, sk_sp<SkRefCnt>, false>());
    test_copy_ctor(reporter, SkSTArray<10, sk_sp<SkRefCnt>,  true>());

    test_move(reporter);

    test_unnecessary_alloc(reporter);

    test_self_assignment(reporter);

    test_reserve<SkTArray<int>>(reporter);
    test_reserve<SkSTArray<1, int>>(reporter);
    test_reserve<SkSTArray<2, int>>(reporter);
    test_reserve<SkSTArray<16, int>>(reporter);
}