예제 #1
0
파일: main.c 프로젝트: netskink/quicksort
int main(int argc, char *argv[]) {

	int iRC;

	iRC=EXIT_SUCCESS;

	if (argc != 1) {
		fprintf(stderr, "Usage: %s\n", argv[0]);
		iRC=EXIT_FAILURE;
		exit(iRC);
	}


	if (test_1())exit(1);
	if (test_2())exit(1);
	if (test_3())exit(1);
	if (test_4())exit(1);
	if (test_5())exit(1);
	if (test_6())exit(1);
	if (test_7())exit(1);
	if (test_8())exit(1);
	if (test_9())exit(1);
	if (test_10())exit(1);
	
	exit(iRC);

}
예제 #2
0
void main()
  {
  FILE *output;
  char buf[5];

  output = stderr;                     /* direct output to a stream */
  fprintf(output, "\n\n"
		  "DATETEST.C By Michael W. Maher 10/13/92\n"
		  "Testing DATECONV.C C functions...\n\n");

  /* Tests days_in_month() function. */
  fprintf(output, "TEST #%d: %s\n", 1, testout(test_1(output), buf));

  /* Tests the days_to_date() function. */
  fprintf(output, "TEST #%d: %s\n", 2, testout(test_2(output), buf));

  /* Test the months_to_date() function. */
  fprintf(output, "TEST #%d: %s\n", 3, testout(test_3(output), buf));

  /* Test the days_elapsed() function. */
  fprintf(output, "TEST #%d: %s\n", 4, testout(test_4(output), buf));

  /* Test Julian / Gregorian date conversion functions. */
  fprintf(output, "TEST #%d: %s\n", 5, testout(test_5(output), buf));
  return;
  }
예제 #3
0
int main(int argc, char **argv) {

    // backlight on
    DDRD |= (1<<0);
    PORTD |= (1<<0);

    MCUSR &= ~_BV(WDRF);
    wdt_disable();

    LCDG_InitPort();
    _delay_ms(30);  // takes longer?
    LCDG_InitLcd();
    LCDG_ClrAllDisp();
    terminal__init();
    
    // TX as out
    DDRD |= (1<<3);

    // RTS as out
    DDRD |= (1<<6);

    print_result(PSTR("RTS=0 TX=0 RX=0"), test_1());
    print_result(PSTR("RTS=0 TX=1 RX=1"), test_2());
    print_result(PSTR("RTS=1 TX=0 RX=0"), test_3());
    print_result(PSTR("RTS=1 TX=1 RX=0"), test_4());

    while(1);
    return 0;
}
예제 #4
0
int main(int argc, char const *argv[]) {
  
  test_1();
  test_2();
  test_3();
  test_4();

  return 0;
}
예제 #5
0
/*-------------------------------------------------------------------------
 * Function:	main
 *
 * Purpose:	Runs external dataset tests.
 *
 * Return:	Success:	exit(0)
 *
 *		Failure:	exit(non-zero)
 *
 * Programmer:	Robb Matzke
 *              Tuesday, March  3, 1998
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
int
main (void)
{
    hid_t	fapl=-1;		/*file access properties	*/
    hid_t	file=-1;		/*file for test_1* functions	*/
    char	filename[1024];		/*file name for test_1* funcs	*/
    hid_t	grp=-1;			/*group to emit diagnostics	*/
    int		nerrors=0;		/*number of errors		*/

    h5_reset();
    fapl = h5_fileaccess();
    h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
    if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
    if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
    if(H5Gclose(grp) < 0) goto error;

    nerrors += test_1a(file);
    nerrors += test_1b(file);
    nerrors += test_1c(file);
    nerrors += test_1d(file);
    nerrors += test_1e(file);
    nerrors += test_1f(file);
    nerrors += test_1g();
    nerrors += test_1h();
    nerrors += test_2(fapl);
    nerrors += test_3(fapl);
    nerrors += test_4(fapl);

    /* Verify symbol table messages are cached */
    nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);

    if (nerrors>0) goto error;

    if (H5Fclose(file) < 0) goto error;
    puts("All external storage tests passed.");
    if (h5_cleanup(FILENAME, fapl)) {
        remove("extern_1a.raw");
        remove("extern_1b.raw");
        remove("extern_2a.raw");
        remove("extern_2b.raw");
        remove("extern_3a.raw");
        remove("extern_3b.raw");
        remove("extern_4a.raw");
        remove("extern_4b.raw");
    }

    return 0;

error:
    H5E_BEGIN_TRY {
        H5Fclose(file);
        H5Pclose(fapl);
    } H5E_END_TRY;
    nerrors = MAX(1, nerrors);
    printf ("%d TEST%s FAILED.\n", nerrors, 1==nerrors?"":"s");
    return 1;
}
예제 #6
0
int main() {
  printf("Test 1\n");
  test_1();
  printf("Test 2\n");
  test_2();
  printf("Test 3\n");
  test_3();
  printf("Test 4\n");
  test_4();
}
예제 #7
0
void test(int N)
{
    test_1(N);
    test_2(N);
    test_3(N);
    test_4(N);
    test_5(N);
    test_6(N);
    test_7(N);
    test_8(N);
}
예제 #8
0
int main()
{
	printf("%i\n", overhead);
	test_1();
	test_2();
	test_3();
	test_4();
	test_5();
	menu();
	return 0;
}
예제 #9
0
/* Main program */
int main (void)
{
  printf("Test 1 (write a byte):         ");  test_1();
  printf("Test 2 (write 1-byte utf-8):   ");  test_2();
  printf("Test 3 (write 2-byte utf-8):   ");  test_3();
  printf("Test 4 (write 3+4-byte utf-8): ");  test_4();
  printf("Test 5 (read a byte):          ");  test_5();
  printf("Test 6 (read 1-byte utf-8):    ");  test_6();
  printf("Test 7 (read 2-byte utf-8):    ");  test_7();
  printf("Test 8 (read 3+4-byte utf-8):  ");  test_8();
  return 0;
}
예제 #10
0
파일: tsllist.c 프로젝트: Logout22/Escape
static void test_sllist(void) {
	test_1();
	test_2();
	test_3();
	test_4();
	test_5();
	test_6();
	test_8();
	test_9();
	test_10();
	test_11();
}
예제 #11
0
void
test_wsdl_main_request(const axutil_env_t* env)
{
	axis2_char_t* wsdl_location = WSDL_FOLDER;
	axis2_char_t* xslt_location = XSLT_FOLDER;
	
	test_1(env, wsdl_location, xslt_location);
	test_2(env, wsdl_location, xslt_location);
	test_3(env, wsdl_location, xslt_location);
	test_4(env, wsdl_location, xslt_location);
	test_5(env, wsdl_location, xslt_location);
}
int main()
{
  std::cout << "Test 2D linear least squares fitting of segments"  << std::endl;

  test_1();
  test_2();
  test_3();  
  test_4();
  test_5(20);
  //  test_2D_point_set(100);

  return 0; // success
}
예제 #13
0
파일: bb_test.c 프로젝트: aeternocap/ecos
int main(){

	printf("Pass: 1, Fail: 0\n=============\n");
	printf("\n\nTest 1aBoolean: %u\n=============\n", test_1a_bool());
	printf("\n\nTest 1aInteger: %u\n=============\n", test_1a_int());
	printf("\n\nTest 1b: %u\n=============\n", test_1b());
	printf("\n\nTest 2: %u\n=============\n", test_2());	
	printf("\n\nTest 3: %u\n=============\n", test_3());	
	printf("\n\nTest 4: %u\n=============\n", test_4());
	printf("\n\nTest 5: %u\n=============\n", test_5());
	printf("\n\nTest 6: %u\n=============\n", test_6());	
	printf("\n\nTest 7: %u\n=============\n", test_7());			
	return 0;
}
예제 #14
0
void test() {
  test_1();
  test_2();
  test_3();
  test_4();
  test_5();
  test_6();
  test_7();
  test_8();
  test_9();
  test_10();
  test_11();
  test_12();
}
예제 #15
0
int main(){
	fixtureSetup();
	resetTestCount();

	testStarted("test_1");
	setup();
		test_1();
	tearDown();
	testEnded();
	testStarted("test_2");
	setup();
		test_2();
	tearDown();
	testEnded();
	testStarted("test_3");
	setup();
		test_3();
	tearDown();
	testEnded();
	testStarted("test_4");
	setup();
		test_4();
	tearDown();
	testEnded();
	testStarted("test_5");
	setup();
		test_5();
	tearDown();
	testEnded();
	testStarted("test_6");
	setup();
		test_6();
	tearDown();
	testEnded();
	testStarted("test_7");
	setup();
		test_7();
	tearDown();
	testEnded();
	testStarted("test_8");
	setup();
		test_8();
	tearDown();
	testEnded();

	summarizeTestCount();
	fixtureTearDown();
	return 0;
}
예제 #16
0
int32_t main (void) {

  setbuf(stdout, NULL);
  printf ("Performing HMAC tests (RFC4231 test vectors)...\n");
  test_1 ();
  test_2 ();
  test_3 ();
  test_4 ();
  test_5 ();
  test_6 ();
  test_7 ();
  printf ("All HMAC tests succeeded!\n\n");

  return 0;
}
예제 #17
0
파일: pop_heap.cpp 프로젝트: QiTai/range-v3
int main()
{
    test_1(1000);
    test_2(1000);
    test_3(1000);
    test_4(1000);
    test_5(1000);
    test_6(1000);
    test_7(1000);
    test_8(1000);
    test_9(1000);
    test_10(1000);

    return test_result();
}
예제 #18
0
파일: main.c 프로젝트: pianist/libswcs
int main(int argc, char** argv)
{
    if (argc == 2)
    {
        test_0(argv[1]);
        return 0;
    }

    test_1();
    test_2();
    test_3();
    test_4();
    test_5();

    return 0;
}
예제 #19
0
int	main(){

	bool test4_pass=test_4();
	std::cout<<"#4 test result = "<<((test4_pass )?"PASS":"******") <<std::endl;

	bool test1_pass=test_1();
	std::cout<<"#1 test result = "<<((test1_pass )?"PASS":"******") <<std::endl;
	bool test2_pass=test_2();
	std::cout<<"#2 test result = "<<((test2_pass )?"PASS":"******") <<std::endl;
	bool test3_pass=test_3(4,10000);
	std::cout<<"#3 test result = "<<((test3_pass )?"PASS":"******") <<std::endl;
	//bool test4_pass=test_4();
	//std::cout<<"#4 test result = "<<((test4_pass )?"PASS":"******") <<std::endl;
	std::cout<<"Final test result = "<<((test1_pass && test2_pass && test3_pass  && test4_pass )?"PASS":"******") <<std::endl;
	return 0;
}
예제 #20
0
int main() {
	int i, j;
	sranddev();
	lnp_routing_table_initialize();
	for (j=0; j<id_n; j++) {
		for (i=0; i<ID_LENGTH; i++) {
			id[j][i] = (u_char)(((double)rand()/RAND_MAX)*26)+'A';
		}
	}
	test_1();
	printf("--------\n");
	test_3();
	printf("--------\n");
	test_4();
	//test_2();
}
예제 #21
0
int main () {

	#ifdef _DEBUG
		Profiler::set_total("ArrayHandler", 24);

		test_1 ();
		test_2 ();
		test_3 ();
		test_4 ();
		test_5 ();
		test_6 ();
		test_7 ();
		test_8 ();
		test_9 ();
		test_10 ();
		test_11 ();
		test_12 ();
		test_13 ();
		test_14 ();
		test_15 ();
		test_16 ();

		cout << "\n\nTesting iterators:\n\n";

		Profiler::set_total("ArrayIterator", 17);

		test_17 ();
		test_18 ();
		test_19 ();
		test_20 ();

		//Profiler::report();
		Profiler::report_to_file();

		cout << "------------------------------------------------------------\n\n";
		cout << "        CHECK Profiler data in Profiler_report.txt\n\n";
		cout << "  To show all debug info - comment line 12 in ArrayIterator.h\n\n";
		cout << "------------------------------------------------------------\n\n";


	#else
		cout << "Testing requires DEBUG mode.\n\n";
	#endif


	return EXIT_SUCCESS;
}
예제 #22
0
int main() {

	printf("1) %d \n", test_1());
	printf("2) %d \n", test_2());
	test_3();
	printf("\n4) %d \n", test_4());
	printf("5) %d \n", test_5());
	printf("6) %d \n", test_6());
	printf("7) %d \n", test_7());
	test_8();
	test_9();
	test_10();
	printf("\n11) string \`%c\` \n", test_11());
	printf("\n12) %d", test_12());
	test_13();
	test_14();
	test_15();
	test_16();
	test_17();
	test_18();
	test_19();
}
예제 #23
0
파일: testcfg.c 프로젝트: 8l/rose
/* The main testfunction. Returns 0 if any error is found in the cfg */
int kfg_testit (KFG kfg, int quiet_mode)
{
  cfg           = kfg;
  quiet         = (quiet_mode == 1);
  error_found   = 0;

  diagnostic ("Consistency test of cfg and PAG-interface ");

  /* do the tests */
  if (0 != kfg_num_nodes (cfg))
    {
      if (error_found < 100) test_1 ();
      if (error_found < 100) test_2 ();
      if (error_found < 100) test_3 ();
      if (error_found < 100) test_4 ();
      if (error_found < 100) test_5 ();
      if (error_found < 100) test_6 ();
      if (error_found < 100) test_7 ();
      if (error_found < 100) test_8 ();
      if (error_found < 100) test_9 ();
      if (error_found < 100) test_10 ();
      if (error_found < 100) test_11 ();
      if (error_found < 100) test_12 ();
      if (error_found < 100) test_13 ();
    }

  /* tests for empty cfg's */
  else test_0 ();

  if (error_found == 0)
    diagnostic (" excellent!\n");
  else
    diagnostic (" ** errors found **\n");

  return (error_found == 0);
}
예제 #24
0
/*-------------------------------------------------------------------------
 * Function:	main
 *
 * Purpose:	Tests global heap.
 *
 * Return:	Success:	zero
 *
 *		Failure:	non-zero
 *
 * Programmer:	Robb Matzke
 *              Tuesday, March 31, 1998
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
int
main (void)
{
    int		nerrors=0;
    hid_t	fapl;

    h5_reset();
    fapl = h5_fileaccess();

    nerrors += test_1(fapl);
    nerrors += test_2(fapl);
    nerrors += test_3(fapl);
    nerrors += test_4(fapl);
    nerrors += test_ooo_indices(fapl);
    if (nerrors) goto error;

    puts("All global heap tests passed.");
    h5_cleanup(FILENAME, fapl);
    return 0;

 error:
    puts("*** TESTS FAILED ***");
    return 1;
}
예제 #25
0
파일: test.c 프로젝트: denji/scrypt
void main () {
  if (test_scrypt_to_string_base91() && test_1() && test_2() && test_3() && test_4()) {
    printf("%s\n", "success - all tests passed.");
  }
}
예제 #26
0
static void setUp_test_3(void)
{
    test_4();
}
예제 #27
0
/**
 *  \brief can_example application entry point.
 *
 *  \return Unused (ANSI-C compatibility).
 */
int main(void)
{
	uint32_t ul_sysclk;
	uint8_t uc_char;

	/* Initialize the SAM system. */
	sysclk_init();
	board_init();

	/* Configure UART for debug message output. */
	configure_console();

	/* Output example information. */
	puts(STRING_HEADER);

	/* Initialize CAN0 Transceiver. */
	sn65hvd234_set_rs(&can0_transceiver, PIN_CAN0_TR_RS_IDX);
	sn65hvd234_set_en(&can0_transceiver, PIN_CAN0_TR_EN_IDX);
	/* Enable CAN0 Transceiver. */
	sn65hvd234_disable_low_power(&can0_transceiver);
	sn65hvd234_enable(&can0_transceiver);

	/* Initialize CAN1 Transceiver. */
	sn65hvd234_set_rs(&can1_transceiver, PIN_CAN1_TR_RS_IDX);
	sn65hvd234_set_en(&can1_transceiver, PIN_CAN1_TR_EN_IDX);
	/* Enable CAN1 Transceiver. */
	sn65hvd234_disable_low_power(&can1_transceiver);
	sn65hvd234_enable(&can1_transceiver);

	/* Enable CAN0 & CAN1 clock. */
	pmc_enable_periph_clk(ID_CAN0);
	pmc_enable_periph_clk(ID_CAN1);

	ul_sysclk = sysclk_get_cpu_hz();
	if (can_init(CAN0, ul_sysclk, CAN_BPS_1000K) &&
		can_init(CAN1, ul_sysclk, CAN_BPS_1000K)) {
		puts("CAN initialization is completed." STRING_EOL);

		/* Disable all CAN0 & CAN1 interrupts. */
		can_disable_interrupt(CAN0, CAN_DISABLE_ALL_INTERRUPT_MASK);
		can_disable_interrupt(CAN1, CAN_DISABLE_ALL_INTERRUPT_MASK);

		/* Configure and enable interrupt of CAN1, as the tests will use receiver interrupt. */
		NVIC_EnableIRQ(CAN1_IRQn);

		/* Run tests. */
		puts("Press any key to start test" STRING_EOL);
		while (uart_read(CONSOLE_UART, &uc_char)) {
		}
		test_1();
		g_ul_recv_status = 0;

		puts("Press any key to continue..." STRING_EOL);
		while (uart_read(CONSOLE_UART, &uc_char)) {
		}
		test_2();
		g_ul_recv_status = 0;

		puts("Press any key to continue..." STRING_EOL);
		while (uart_read(CONSOLE_UART, &uc_char)) {
		}
		test_3();
		g_ul_recv_status = 0;

		puts("Press any key to continue..." STRING_EOL);
		while (uart_read(CONSOLE_UART, &uc_char)) {
		}
		test_4();
		g_ul_recv_status = 0;

		/* Disable CAN0 Controller */
		can_disable(CAN0);
		/* Disable CAN0 Transceiver */
		sn65hvd234_enable_low_power(&can0_transceiver);
		sn65hvd234_disable(&can0_transceiver);

		/* Disable CAN1 Controller */
		can_disable(CAN1);
		/* Disable CAN1 Transceiver */
		sn65hvd234_enable_low_power(&can1_transceiver);
		sn65hvd234_disable(&can1_transceiver);

		puts("End of all tests" STRING_EOL);
	} else {
		puts("CAN initialization (sync) ERROR" STRING_EOL);
	}

	while (1) {
	}
}
예제 #28
0
int
run_main (int, ACE_TCHAR *[])
{
  ACE_START_TEST (ACE_TEXT ("Recursive_Condition_Test"));

#if defined (ACE_HAS_THREADS)
  int status = 0;

  /* Test 1 - Simple test */
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test 1...\n")));
  if (test_1 () != 0)
    ++status;

  /* Test #2 - Sleep 2 seconds before releasing mutex */
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test 2...\n")));
  if (test_2 () != 0)
    ++status;

  /* Test #3 - One main thread - 4 subthreads */
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test 3...\n")));
  if (test_3 () != 0)
    ++status;

  /* Test #4 - Multiple calls to mutex_.acquire and mutex_.release */
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test 4...\n")));
  if (test_4 () != 0)
    ++status;

  // Timer queue usage.
  Thread_Timer_Queue timer_queue;
  Test_Handler handler;
  if (0 != timer_queue.activate ())
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("activate")));
      ++status;
    }

  ACE_Time_Value timeout =
    ACE_OS::gettimeofday() + ACE_Time_Value (1, 0);

  if (-1 == timer_queue.schedule (&handler, &timer_queue, timeout))
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("schedule")));
      ++status;
    }

  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Starting to sleep\n")));
  ACE_OS::sleep (10);
  timer_queue.deactivate ();
  timer_queue.wait ();
  // Scheduling every second, waiting 10 seconds, should get at least 9
  int expirations = handler.nr_expirations ();
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Caught %d timer expirations\n"),
              expirations));
  if (expirations < 9)
    ACE_ERROR ((LM_ERROR, ACE_TEXT ("Should have caught at least 9\n")));

#else
  ACE_ERROR ((LM_ERROR,
              ACE_TEXT ("ACE doesn't support recursive condition variables on this platform\n")));
#endif /* ACE_HAS_THREADS */
  ACE_END_TEST;
  return 0;
}
예제 #29
0
int main(void)
{
        uint32_t result = TC_PASS;

        TC_START("Performing SHA256 tests (NIST tests vectors):");

        result = test_1();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #1 failed.\n");
                goto exitTest;
        }
        result = test_2();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #2 failed.\n");
                goto exitTest;
        }
        result = test_3();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #3 failed.\n");
                goto exitTest;
        }
        result = test_4();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #4 failed.\n");
                goto exitTest;
        }
        result = test_5();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #5 failed.\n");
                goto exitTest;
        }
        result = test_6();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #6 failed.\n");
                goto exitTest;
        }
        result = test_7();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #7 failed.\n");
                goto exitTest;
        }
        result = test_8();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #8 failed.\n");
                goto exitTest;
        }
        result = test_9();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #9 failed.\n");
                goto exitTest;
        }
        result = test_10();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #10 failed.\n");
                goto exitTest;
        }
        result = test_11();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #11 failed.\n");
                goto exitTest;
        }
        result = test_12();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #12 failed.\n");
                goto exitTest;
        }
        result = test_13();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #13 failed.\n");
                goto exitTest;
        }
        result = test_14();
        if (result == TC_FAIL) { /* terminate test */
                TC_ERROR("SHA256 test #14 failed.\n");
                goto exitTest;
        }

        TC_PRINT("All SHA256 tests succeeded!\n");

exitTest:
        TC_END_RESULT(result);
        TC_END_REPORT(result);
}