Beispiel #1
0
int main()
{
	plan(20);
	test_uints();
	test_ints();
	test_bools();
	test_floats();
	test_doubles();
	test_nils();
	test_strls();
	test_binls();
	test_strs();
	test_bins();
	test_arrays();
	test_maps();
	test_next_on_arrays();
	test_next_on_maps();
	test_compare_uints();
	test_format();
	test_mp_print();
	test_mp_check();
	test_numbers();
	test_overflow();

	return check_plan();
}
Beispiel #2
0
void testmain(void) {
    print("sizeof");
    test_primitives();
    test_pointers();
    test_unsigned();
    test_literals();
    test_arrays();
    test_vars();
    test_struct();
    test_constexpr();
}
Beispiel #3
0
int main(int argc, char const *argv[])
{
      test_bit_algo();
      test_quicksort();
      test_binary_search();
      test_kadane();
      test_knapsack();
      test_some_math();
      test_strings();
      test_arrays();
      printf("YEAH!\n");

      return 0;
}
Beispiel #4
0
/*-------------------------------------------------------------------------
* test H5LTtext_to_dtype function
*-------------------------------------------------------------------------
*/
static int test_text_dtype(void)
{
    TESTING("H5LTtext_to_dtype");

    if(test_integers()<0)
        goto out;

    if(test_fps()<0)
        goto out;

    if(test_strings()<0)
        goto out;

    if(test_opaques()<0)
        goto out;

    if(test_enums()<0)
        goto out;

    if(test_variables()<0)
        goto out;

    if(test_arrays()<0)
        goto out;

    if(test_compounds()<0)
        goto out;

    if(test_compound_bug()<0)
        goto out;

    if(test_complicated_compound()<0)
        goto out;

    return 0;

out:
    return -1;
}
Beispiel #5
0
int main()
{
    plan(15);

    test_uints();
    test_ints();
    test_bools();
    test_floats();
    test_doubles();
    test_nils();
    test_strls();
    test_binls();
    test_strs();
    test_bins();
    test_arrays();
    test_maps();
    test_next_on_arrays();
    test_next_on_maps();
    test_compare_uints();

    return check_plan();
}
Beispiel #6
0
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  int status = 0;

  try
    {
      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      ::Test::vtp_init *vtp_factory = 0;
      ACE_NEW_THROW_EX (vtp_factory,
                        ::Test::vtp_init,
                        CORBA::NO_MEMORY ());
      CORBA::ValueFactoryBase_var vtp_factory_owner = vtp_factory;

      orb->register_value_factory (vtp_factory->tao_repository_id (),
                                   vtp_factory);

      if (parse_args (argc, argv) != 0)
        return 1;

      CORBA::Object_var object =
        orb->string_to_object (ior);

      Test::A_var server =
        Test::A::_narrow (object.in ());

      if (CORBA::is_nil (server.in ()))
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("Object reference <%s> is nil\n"),
                             ior),
                            1);
        }

      status |= test_strings (server.in ());

      status |= test_sequences (server.in ());

      status |= test_arrays (server.in ());

      status |= test_structs (server.in ());

      status |= test_unions (server.in ());

      status |= test_valueboxes (server.in ());

      status |= test_valuetypes (server.in (), vtp_factory);

      status |= test_exceptions (server.in ());

      server->shutdown ();

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Caught exception in client:");
      return 1;
    }

  return status;
}
Beispiel #7
0
int Test::all() {

	clock_t begin = clock();
	exeTime = 0;

	test_general();
	test_types();
	test_booleans();
	test_numbers();
	test_strings();
	test_arrays();
	test_intervals();
	test_map();
	test_set();
	test_objects();
	test_functions();
	test_classes();
	test_loops();
	test_operators();
	test_references();
	test_exceptions();
	test_operations();
	test_system();
	test_json();
	test_files();
	test_doc();
	test_utils();

	double elapsed_secs = double(clock() - begin) / CLOCKS_PER_SEC;
	int errors = (total - success_count);
	int leaks = (obj_created - obj_deleted);
	int mpz_leaks = (mpz_obj_created - mpz_obj_deleted);

	std::ostringstream line1, line2, line3, line4;
	line1 << "Total : " << total << ", success : " << success_count << ", errors : " << errors;
	line2 << "Total time : " << elapsed_secs * 1000 << " ms";
	line3 << "Objects destroyed : " << obj_deleted << " / " << obj_created << " (" << leaks << " leaked)";
	line4 << "MPZ objects destroyed : " << mpz_obj_deleted << " / " << mpz_obj_created << " (" << mpz_leaks << " leaked)";
	unsigned w = std::max(line1.str().size(), std::max(line2.str().size(), std::max(line3.str().size(), line4.str().size())));

	auto pad = [](std::string s, int l) {
		l -= s.size();
		while (l-- > 0) s += " ";
		return s;
	};
	std::cout << "┌";
	for (unsigned i = 0; i < w + 2; ++i) std::cout << "─";
	std::cout << "┐" << std::endl;
	std::cout << "│ " << pad(line1.str(), w) << " │" << std::endl;
	std::cout << "│ " << pad(line2.str(), w) << " │" << std::endl;
	std::cout << "│ " << pad(line3.str(), w) << " │" << std::endl;
	std::cout << "│ " << pad(line4.str(), w) << " │" << std::endl;
	std::cout << "├";
	for (unsigned i = 0; i < w + 2; ++i) std::cout << "─";
	std::cout << "┤";
	std::cout << std::endl;

	int result = abs(errors) + abs(leaks) + abs(mpz_leaks);
	if (result == 0) {
		std::cout << "│ " << pad("GOOD! ✔", w + 2) << " │" << std::endl;
	} else {
		std::cout << "│ " << pad("BAD! : " + std::to_string(result) + " error(s) ✘", w + 2) << " │" << std::endl;
	}
	std::cout << "└";
	for (unsigned i = 0; i < w + 2; ++i) std::cout << "─";
	std::cout << "┘" << std::endl;

	for (const auto& error : failed_tests) {
		std::cout << " " << error << std::endl;
	}
	if (failed_tests.size()) {
		std::cout << std::endl;
	}
	return result;
}