コード例 #1
0
ファイル: timer.c プロジェクト: PTJohe/LCOM
int timer_test_config(unsigned long timer) {
	unsigned char conf;
	timer_get_conf(timer, &conf);
	timer_display_conf(conf);
	if (conf = 0xB6)
		return EXIT_SUCCESS;
	else
		return EXIT_FAILURE;
}
コード例 #2
0
ファイル: timer.c プロジェクト: gtugablue/LCOM-Racinix
int timer_test_config(unsigned long timer) {
	unsigned long *st;
	if ((st = malloc(sizeof(unsigned char))) != NULL)
	{
		if (timer_get_conf(timer, st))
		{
			free(st);
			return 1;
		}
		return timer_display_conf((unsigned char)*st);
	}
	free(st);
	return 1;
}
コード例 #3
0
ファイル: timer.c プロジェクト: Pigmoth69/LCOM-DODGEM
int timer_test_config(unsigned long timer)
{
	unsigned char tempo;
	int erro;
	if(timer<0 || timer >2)
	{
		return 1;
	}
	erro = timer_get_conf(timer,&tempo);

	if(erro == 1)
		return 1;


	erro = timer_display_conf(tempo);

	if(erro == 1)
		return 1;

	return 0;
}
コード例 #4
0
ファイル: lab2.c プロジェクト: bernardobelchior1/feup-lcom
static int proc_args(int argc, char *argv[]) {

  unsigned long freq, time;
  unsigned char conf;

  /* check the function to test: if the first characters match, accept it */
  if (strncmp(argv[1], "display_conf", strlen("display_conf")) == 0) {
	  if( argc != 3 ) {
		  printf("timer: wrong no of arguments for test of timer_display_conf() \n");
		  return 1;
	  }
	  if( (conf = parse_ulong(argv[2], 0)) == ULONG_MAX )
	 		  return 1;
	  printf("timer:: timer_display_conf(%d)\n", conf);
	  timer_display_conf(conf);
	  return 0;
  } else if (strncmp(argv[1], "test_int", strlen("test_int")) == 0) {
	  if( argc != 3 ) {
		  printf("timer: wrong no of arguments for test of timer_test_int() \n");
		  return 1;
	  }
	  if( (time = parse_ulong(argv[2], 16)) == ULONG_MAX )
		  return 1;
	  printf("timer:: timer_test_int(%d)\n", time);
	  timer_test_int(time);
	  return 0;
  } else if (strncmp(argv[1], "test_square", strlen("test_square")) == 0) {
	  if( argc != 3 ) {
		  printf("timer: wrong no of arguments for test of timer_test_square() \n");
		  return 1;
	  }
	  if( (freq = parse_ulong(argv[2], 16)) == ULONG_MAX )
		  return 1;
	  printf("timer:: timer_test_square(%d)\n", freq);
	  return timer_test_square(freq);
  } else {
	  printf("timer: non valid function \"%s\" to test\n", argv[1]);
	  return 1;
  }
}