Example #1
0
int main(int argc, char **argv)
{
	int i, j;
	int seed;

	randk_reset();
	if(argc < 2 || !(seed = atoi(argv[1])))
	{
		//seed = time(NULL);
		randk_seed();
	}
	else
	{
		printf("SEED: %u\n", seed);
		//srand(seed);
		randk_seed_manual(seed);
	}
	
	printf(";;k = 5;;;;k = log2(n);;;;k = sqrt(n);;;;k = n/2;\n");
	printf("i;n;Stupid;Heap;Median;Quick;");
	printf("Stupid;Heap;Median;Quick;");
	printf("Stupid;Heap;Median;Quick;");
	printf("Stupid;Heap;Median;Quick;\n");
	
	for (i = 1; i <= 15; i++)
	{
		int n = 1000 * (1 << i);
		instance_a(vet, n);
		printf("%d;%d;", i, n);
		test_battery(n);
	}
	
	printf("j;p;\n");
	
	for (j = 1; j <= 15; j++)
	{
		int p = 1 << j;
		instance_b(vet, INPUT_MAX, p);
		printf("%d;%d;", j, p);
		test_battery(INPUT_MAX);
	}
	
	return 0;
}
Example #2
0
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
LRESULT CMainFrame::OnPower(WPARAM uID, LPARAM uMouseMsg)
{
// We used to check battery status only after we got this message.  However,
// on my laptop prime95 sometimes would not restart when AC power resumed.
// Now we'll test using a timer as well as this Windows message (so we don't
// have a delay in shutting threads down when we go on battery)
	if (uID == PBT_APMPOWERSTATUSCHANGE) {
		if (is_timed_event_active (TE_BATTERY_CHECK)) test_battery ();
	}
	return 0;
}
Example #3
0
int 
main(int argc, char **argv)
{
        size_t i = 0;
        int retval = EXIT_FAILURE;
        int tests  = 1;

        if (argc > 1)
            tests = atoi(argv[1]);

        for (i = 0; i < tests; ++i) {
            printf("test #%d out of %d\n-----------------\n\n", 
                   (int)i + 1, tests);
            test_battery();
        }

        return retval;
}
Example #4
0
int main()
{
    // If button A is pressed, test the PD0/PD1 outputs
	if(button_is_pressed(BUTTON_A))
		test_outputs();

	// If button C is not pressed down, go to the demo.
	if(!button_is_pressed(BUTTON_C) && !test_pushbutton_tries())
		demo();

	// Load bar graph characters.
	// Together with space and the solid block at 255, this makes almost
	// all possible bar heights, with two to spare.
	unsigned char i;
	for(i=0;i<6;i++)
	{
		lcd_load_custom_character(bars+i,i);
	}
	clear();

	pololu_3pi_init(TEST_LINE_SENSOR_TIMEOUT);

	if(test_pushbutton_tries())
		goto pushbuttons;

	play_from_program_space(welcome_test);
	print_two_lines_delay_1s_test(welcome_test_line1,welcome_test_line2);
	print_two_lines_delay_1s_test(test_name_line1,test_name_line2);

	clear();

 	test_battery();
	test_qtr();
	test_motors();
	test_pot();
pushbuttons:
	test_pushbuttons();

	clear();
	print("Success");
	play("O5 c16");
	
	while(1);
}