Exemple #1
0
void segment_operator()
{
    test_op("","a",-1);
    test_op("","",0);
    test_op("aa","aaa",-1);
    test_op("aa","ab",-1);
}
static int test_filter(struct event_format *event,
		       struct filter_arg *arg, struct pevent_record *record)
{
	switch (arg->type) {
	case FILTER_ARG_BOOLEAN:
		/* easy case */
		return arg->boolean.value;

	case FILTER_ARG_OP:
		return test_op(event, arg, record);

	case FILTER_ARG_NUM:
		return test_num(event, arg, record);

	case FILTER_ARG_STR:
		return test_str(event, arg, record);

	case FILTER_ARG_EXP:
	case FILTER_ARG_VALUE:
	case FILTER_ARG_FIELD:
		/*
		 * Expressions, fields and values evaluate
		 * to true if they return non zero
		 */
		return !!get_arg_value(event, arg, record);

	default:
		die("oops!");
		/* ?? */
		return 0;
	}
}
Exemple #3
0
int batch_test(char* prog_name, int argc, char *argv[]) {
  if (argc != 10) {
    printf("Usage: %s test <oper> <num of cores> <num of rounds>\n", prog_name);
    printf("       <int> <int> <int> range of fst input\n");
    printf("       <int> <int> <int> range of snd input\n\n");
    printf("       range is in form of <start> <end> <step>\n");
    printf("       say range is <0> <100> <10>\n");
    printf("       I'll test at point 0, 10, 20, 30, .. 100\n");
    printf("       11 points\n");
    printf("       it's for (i = fst_sz_start; i <= fst_sz_end; i += fst_sz_step)\n");
    printf("       If both operands is in form of range, then I'll test\n");
    printf("       every combination, and output to CSV file\n\n");
    printf("   and <oper> is one of:\n");
    usage_common();
    printf("\nExample test:\n");
    printf("   %s test add_s 4 10 10 110 20 100 1000 100\n", prog_name);
    return 0;
  }
  oper op = str2oper(argv[1]);
  int fst_sz_start, fst_sz_end, fst_sz_step;
  int snd_sz_start, snd_sz_end, snd_sz_step;
  int core_num = atoi(argv[2]);
  int round = atoi(argv[3]);
  fst_sz_start = atoi(argv[4]);
  fst_sz_end = atoi(argv[5]);
  fst_sz_step = atoi(argv[6]);
  snd_sz_start = atoi(argv[7]);
  snd_sz_end = atoi(argv[8]);
  snd_sz_step = atoi(argv[9]);
  char *opstr = argv[1];

  test_op(opstr, op, core_num, round, fst_sz_start, fst_sz_end, fst_sz_step,
    snd_sz_start, snd_sz_end, snd_sz_step);
  return 0;
}
Exemple #4
0
int main()
{
    test_op();
    test_Transformation_E3();
    test_Transformation_E3_operator_mult();
    test_rotation();
    test_inverse();
    test_Bbox_E3_operator_incr();
    test_polygon_Bbox();
    test_polygon_quad_subdivide();
    test_polygon_normal();

    test_dominant();

    runme();
}
Exemple #5
0
void test_operation( int *passed, int *failed )
{
    int op_passed = 0;
    int op_failed = 0;
    test_op( "EMPTY", EMPTY, &op_passed, &op_failed );
    test_op( "ADD", ADD, &op_passed, &op_failed );
    test_op( "HELP", HELP, &op_passed, &op_failed );
    test_op( "LIST", LIST, &op_passed, &op_failed );
    test_op( "RUN", RUN, &op_passed, &op_failed );
    test_op( "VERSION", VERSION, &op_passed, &op_failed );
    *passed += op_passed;
    *failed += op_failed;
}