示例#1
0
文件: ss.cpp 项目: glycerine/shore-mt
int main(int argc, char **argv)
{
    int            len = 30;
    if (argc > 1)
        len = atoi(argv[1]);

    cout << "len = " << len  ;
    cout << "; args = " ;
    for(int i=2; i<argc; i++)
    {
        cout << argv[i];
    }
    cout << endl;
    bool terminate = false;
    if (len < 0) {
        terminate = true;
        len = -len;
    }
    w_ostrstream_buf    s(len);
    w_ostrstream        s2;

	testit(terminate, s, argc, argv);
	testit(terminate, s2, argc, argv);

    return 0;
}
示例#2
0
TEST (SSTest, Test2) {
    w_ostrstream_buf    s(30);
    w_ostrstream        s2;
    const char * args[] = {
        "sdkjfhkjsd", "dkjfshkjdhf", "sdfdf", "sss"
    };
    std::string res1 = testit(true, s, 4, args);
    std::string res2 = testit(true, s2, 4, args);
    EXPECT_STREQ (res1.c_str(), res2.c_str());
}
示例#3
0
TEST (SSTest, Test1) {
    w_ostrstream_buf    s(40);
    w_ostrstream        s2;
    const char * args[] = {
        "abcd", "fghi", "klmn", "pqrs", "uvwxyz"
    };
    std::string res1 = testit(false, s, 5, args);
    std::string res2 = testit(false, s2, 5, args);
    EXPECT_STREQ (res1.c_str(), res2.c_str());
}
示例#4
0
int
main(void)
{

	printf("1..5\n");

	testit(TESTFQDN, -1, TESTHOST, "self");
	testit("XXX" TESTDOMAIN, -1, "XXX", "different host, same domain");
	testit("XXX" TESTDOMAIN, 1, NULL, "short hostsize");
	testit("bogus.example.net", -1, NULL, "arbitrary host");
	testit("XXX." TESTFQDN, -1, NULL, "domain is local hostname");

	return (0);
}
示例#5
0
static void test(int fn)
{
	int i, percent, block = 0, num = 85;

	while (block < num) {
		percent = block * 100 / num;
		for (i = 0; i < 10; i++) {
			testit(fn, percent);
			msleep(5);
		}
		block++;
		msleep(10);
	}
	testit(fn, 100);
}
示例#6
0
void main () {
    WK_word* a;
    WK_word* b;
    unsigned int word;
    unsigned int words;
    unsigned int iterations = 1;
    unsigned int i;

    printf("How many words? ");
    scanf("%d",&words);

    a = (WK_word*) malloc (sizeof(WK_word) *
                           words);
    b = (WK_word*) malloc (sizeof(WK_word) *
                           words * 2);

    for (i = 0; i < words; i++) {
        a[i] = 0;
    }
    printf("All zeros:\n\n");
    testit (a, b, words, iterations);

    for (i = 0; i < words; i++) {
        a[i] = (WK_word)lrand48();
    }
    printf("Random data:\n\n");
    testit (a, b, words, iterations);

    for (i = 0; i < words; i++) {
        switch (lrand48() % 4) {
        case 0:
            a[i] = 0xf5ba0132;
            break;
        case 1:
            a[i] = 0x10832;
            break;
        case 2:
            a[i] = 0xf5ba03e7;
            break;
        case 3:
            a[i] = 0x55555555;
            break;
        }
    }
    printf("Somewhat patterned:\n\n");
    testit (a, b, words, iterations);

}
示例#7
0
int main(int argc, char * argv[]) {
  int l[] = {1,2,3};

  printf("SIZE * / SIZE 0: %lu/%lu\n", sizeof(l), sizeof(l[0]));

  testit(l);
}
示例#8
0
test_8 (int code)
{
  _Bool temp = testit ();
  _Bool rotate = (code == 22);
  if (temp == 0 || !rotate)
    oof ();
}
示例#9
0
int main(int argc, char **argv)
{
    int nchanged;
    int old_oldroot_len;

    if (argc == 2 && strcmp(argv[1], "--test") == 0) {
	testit();
	exit(0);
    }

    if (argc < 4)
        fatalError("Usage: %s <old root> <new root> <directoryToSearch> [<old_oldrootlen>]\n", argv[0]);

    old_oldroot_len = strlen(argv[1]);
    if (argc == 5)
        old_oldroot_len = atoi(argv[4]);	/* only if it was previously relocated from a loooong path */

    nchanged = ReplaceStringsInMatchingFiles(argv[1], argv[2], argv[3], old_oldroot_len);

    if (nchanged > 0) {
        printf("%d files updated.\n", nchanged);
        return 0;
    }
    printf("No files changed!\n");
    return 1;
}
示例#10
0
文件: testit.c 项目: Mylf/fillit
void		testit(t_tet **lst, t_fill *res)
{
	t_tet	*cpy;
	int		x;
	int		y;
	int		k;

	x = 0;
	y = 0;
	k = -1;
	cpy = *lst;
	while (cpltd(lst) != 0)
	{
		while ((k = chcktet(cpy, res)) != 0 && res->x < res->gsize)
			nextpo(res);
		cpy = ret(res, cpy, k);
		if (k == -1 && cpy->prev == NULL && res->x >= res->gsize)
		{
			reblst(lst);
			testit(lst, newfill(cnttet(lst), res->gsize + 1));
			return ;
		}
	}
	tnfill(res);
}
示例#11
0
test_7 (int code)
{
  _Bool temp = testit ();
  _Bool rotate = (code == 22);
  if (!rotate || temp == 0)
    oof ();
}
示例#12
0
/* ----------------------------------------------------------------------- */
int main(int argc, char *argv[]) {
  int STEP, NUMTHREADS;
  double total_time;
  char *PARAM_NAMES[NUM_ARGS] = {"Size (in K)"};
  char *TIMERS_NAMES[NUM_TIMERS] = {"Total_time" };
  char *DEFAULT_VALUES[NUM_ARGS] = {"2048 K"};


  NUMTHREADS = omp_get_max_threads();
  OSCR_init (NUMTHREADS, "Quicksort", "Use 'qsort' <size (in K)>", NUM_ARGS,
    PARAM_NAMES, DEFAULT_VALUES , NUM_TIMERS, NUM_TIMERS, TIMERS_NAMES,
    argc, argv);

  SIZE = OSCR_getarg_int(1);
  if (SIZE > MAXSIZE) {
    printf("Size: %d Maximum size: %d\n", SIZE, MAXSIZE);
    exit(-1);
  }
	/* Default: DEFAULT_SIZE */
  for (STEP = 0; STEP < NUM_STEPS; STEP++) {
    initialize(array, STEP);
	  OSCR_timer_start(0);
    qs(array, 0, SIZE-1);
		OSCR_timer_stop(0);
    testit(array);
  }
	total_time = OSCR_timer_read(0);
	OSCR_report(1, TIMERS_NAMES);
	printf("\n \t# THREADS \tSIZE \tSTEPS \tTIME (secs.) \n");
	printf("\t%d \t\t%d \t%d \t%14.6lf \n", NUMTHREADS, SIZE, NUM_STEPS, total_time);

} /* main */
示例#13
0
void
test_6 (int code)
{
  _Bool temp = testit ();
  _Bool rotate = (code == 22);
  if (!rotate && temp == 0)
    oof ();
}
示例#14
0
void
test_5 (int code)
{
  _Bool temp = testit ();
  _Bool rotate = (code == 22);
  if (temp == 0 && !rotate)
    oof ();
}
示例#15
0
int main(int argc, char **argv) {
	int i;
	uint64_t time1, time2;

	int mode = 0;
	if (argc>1) {
		if (!strcmp(argv[1], "-h")) {
			printf("Usage: %s <mode>\n", argv[0]);
			printf("\tmode = 0:  test all cases\n");
			printf("\tmode = -1: allocate/deallocate until failure\n");
			printf("\tmode > 0:  run test <tmode>\n");
			exit(0);
		}
		mode=atoi(argv[1]);
	}
	
	/* install SIGBUS handler */
	struct sigaction my_sigaction;
	my_sigaction.sa_handler = test_signal_handler;
	my_sigaction.sa_flags = SA_RESTART;
	my_sigaction.sa_mask = 0;
	sigaction( SIGBUS, &my_sigaction, NULL );
	sigaction( SIGSEGV, &my_sigaction, NULL );
	
	if (mode>0)		/* one specific test */
		testit(mode-1);

	if (mode==0) {	/* test all cases */
		printf("Running %d tests:\n", TESTS);
		for (i=0; i<TESTS; i++) {
			testit(i);
		}
	}
	if (mode==-1) {	/* alloc/dealloc */
			boolean_t ret;
		do {
			ret = test_alloc_dealloc(TRUE);
			printf(".");
			fflush(stdout);
		} while (ret);
		if (error[0])
			printf (" (%s)\n", error);
	}
	return 0;
}
示例#16
0
void main () {
  UBYTE* a;
  UBYTE* b;
  unsigned int bytes;
  unsigned int iterations = 1;
  unsigned int i;

  printf("How many bytes? ");
  scanf("%d",&bytes);

  /*
  printf("How many iterations? ");
  scanf("%d", &iterations);
  */

  a = (UBYTE*)malloc(sizeof(UBYTE) * bytes);
  b = (UBYTE*)malloc(sizeof(UBYTE) * bytes * 2);

  for (i = 0; i < bytes; i++) {
    a[i] = 0;
  }
  printf("All zeros:\n\n");
  testit (a, b, bytes, iterations);

  for (i = 0; i < bytes; i++) {
    switch (lrand48() % 4) {
    case 0:
      a[i] = 0x32;
      break;
    case 1:
      a[i] = 0x33;
      break;
    case 2:
      a[i] = 0xe7;
      break;
    case 3:
      a[i] = 0x55;
      break;
    }
  }
  printf("Somewhat patterned:\n\n");
  testit (a, b, bytes, iterations);

}
示例#17
0
文件: galois.c 项目: hongbinz/poc
int main(void) {
  gf a, b, c;

  gf_init();
  a = 1;
  b = 37;
  c = 78;
  testit("1 * ( 37 + 78 ) = 1 * 37 + 1 * 78",
         GF_MUL(a, GF_ADD(b, c)),
         GF_ADD(GF_MUL(a, b), GF_MUL(a, c)));
  testit("(1 * 37) * 78 = 1 * (37 * 78)",
         GF_MUL(GF_MUL(a, b), c),
         GF_MUL(a, GF_MUL(b, c)));
  testit("(37 * 78) * 37 = (37 * 37) * 78",
         GF_MUL(GF_MUL(b, c), b),
         GF_MUL(GF_MUL(b, b), c));
  testit("b * b^-1 = 1", GF_MUL(b, GF_INV(b)), 1);

  return 0;
}
示例#18
0
int
run_main (int, ACE_TCHAR *[])
{
  ACE_START_TEST (ACE_TEXT ("Bug_3974_Regression_Test"));
  int result = 0;

  ACE_Select_Reactor r1;
  if (!testit (&r1))
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("Select_Reactor failed\n")));
      result = 1;
    }

  ACE_TP_Reactor r2;
  if (!testit (&r2))
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("TP_Reactor failed\n")));
      result = 1;
    }

#ifdef ACE_WIN32
  ACE_WFMO_Reactor r3;
  if (!testit (&r3))
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("WFMO_Reactor failed\n")));
      result = 1;
    }
#endif /* ACE_WIN32 */

#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
  ACE_Dev_Poll_Reactor r4;
  if (!testit (&r4))
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("Dev_Poll_Reactor failed\n")));
      result = 1;
    }
#endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */

  ACE_END_TEST;
  return result;
}
示例#19
0
int
main(int argc, char *argv[])
{
	static const int ntests = sizeof(tests) / sizeof(tests[0]) / 2;
	int i;

	printf("1..%d\n", ntests);
	for (i = 0; i < ntests; i++)
		testit(i + 1, tests[i * 2], tests[i * 2 + 1]);

	return (0);
}
示例#20
0
int main()

{
  int a = 0;

  if (b)
    func();

  /* simplify_and_const_int would incorrectly omit the mask in
     the line below.  */
  testit ((a + 23) & 0xfffffffc);
  exit (0);
}
示例#21
0
文件: loop-5.c 项目: 0day-ci/gcc
int main(void)
{
  testit();
  if (a[0] != 0)
    abort();
  if (a[1] != 3)
    abort();
  if (a[2] != 2)
    abort();
  if (a[3] != 1)
    abort();
  exit(0);
}
示例#22
0
int
run_main (int, ACE_TCHAR *[])
{
  ACE_START_TEST (ACE_TEXT ("Memcpy_Test"));

  //ACE_Time_Value start, now;
  struct timeval start, now;

  for (int i = ITERATIONS; i > 0; --i)
    testit (0);

  start = ACE_High_Res_Timer::gettimeofday_hr ();
  for (int j = ITERATIONS; j > 0; --j)
    testit (0);

  now = ACE_High_Res_Timer::gettimeofday_hr ();

  double fast = 1000000  *(now.tv_sec - start.tv_sec) +
    now.tv_usec - start.tv_usec;
  ACE_DEBUG ((LM_DEBUG,
               ACE_TEXT ("%f uSec per iteration for fast version.\n"),
               fast / ITERATIONS));

  start = ACE_High_Res_Timer::gettimeofday_hr ();
  for (int k = ITERATIONS; k > 0; --k)
    testit (1);

  now = ACE_High_Res_Timer::gettimeofday_hr ();

  double slow = 1000000 * (now.tv_sec-start.tv_sec) + now.tv_usec - start.tv_usec;
  ACE_DEBUG ((LM_DEBUG,
               ACE_TEXT ("%f uSec per iteration for slow version.\n"),
               slow / ITERATIONS));

  ACE_END_TEST;

  return 0;
}
void
testTortureExecute (void)
{
  testit();
  if (a[0] != 0)
    ASSERT (0);
  if (a[1] != 3)
    ASSERT (0);
  if (a[2] != 2)
    ASSERT (0);
  if (a[3] != 1)
    ASSERT (0);
  return;
}
示例#24
0
    void
    run(int)
    {
        try
        {
            cv::RgbdPlane plane_computer;

            std::vector<Plane> planes;
            cv::Mat points3d, ground_normals;
            cv::Mat_<unsigned char> plane_mask;
            gen_points_3d(planes, plane_mask, points3d, ground_normals, 1);
            testit(planes, plane_mask, points3d, plane_computer, 0.08); // 1 plane, continuous scene, very low error..
            for (int ii = 0; ii < 10; ii++)
            {
                gen_points_3d(planes, plane_mask, points3d, ground_normals, 3); //three planes
                testit(planes, plane_mask, points3d, plane_computer, 0.08); // 3 discontinuities, more error expected.
            }
        } catch (...)
        {
            ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
        }
        ts->set_failed_test_info(cvtest::TS::OK);
    }
示例#25
0
static int run_test(char *arg)
{
	int op = -1;
	struct { char *arg; int op; } opts[] = {
		{ "complete-cycle",    200 },
		{ "disable-enable",    201 },
		{ "false-ack",         202 },
		{ "false-unsubscribe", 203 },
		{ "failed-kick",       204 },
		{ "no-kick",           205 },
		{ "premature-trigger", 206 },
		{ NULL, 0 }
	};

	for (int i = 0; opts[i].arg; i++) {
		if (string_match(opts[i].arg, arg)) {
			op = opts[i].op;
			break;
		}
	}

	switch (op) {
		case 200:
			return testit();

		case 201:
			disable_enable = 1;
			return testit();

		case 202:
			false_ack = 1;
			return testit();

		case 203:
			false_unsubscribe = 1;
			return testit();

		case 204:
			failed_kick = 1;
			return testit();

		case 205:
			no_kick = 1;
			return testit();

		case 206:
			premature = 1;
			return testit();
	}

	return -1;
}
示例#26
0
文件: bs.c 项目: kgadek/kpfp
int main() {
	int i;
	struct tms sta_tms, sto_tms;
	clock_t start, stop;

	srand(time(0));

	A = malloc(32 * sizeof(int));

	for(i=0;i<32;++i)
		A[i] = i;

	start = times(&sta_tms);
	i = testit();
	stop = times(&sto_tms);

	printf("Czas %d: %jd\n", i, (stop-start));

	free(A);
	return 0;
}
示例#27
0
文件: search.c 项目: ricksladkey/vile
/*
 * scanner -- Search for a pattern in either direction.  can optionally
 * wrap around end of buffer.
 */
int
scanner(
	   regexp * exp,	/* the compiled expression */
	   int direct,		/* up or down */
	   int wrapok,		/* ok to wrap around end of buffer? */
	   int *wrappedp)
{
    MARK curpos;
    int found;
    int wrapped = FALSE;
    int leftmargin = b_left_margin(curbp);

    TRACE((T_CALLED "scanner %s %s\n",
	   ((direct == FORWARD) ? "forward" : "backward"),
	   (wrapok ? "wrapok" : "nowrapok")));

    if (!exp) {
	mlforce("BUG: null exp");
	returnCode(FALSE);
    }

    /* Set starting search position to current position
     */
    curpos = DOT;
    if (curpos.o < leftmargin)
	curpos.o = leftmargin;

    /* Scan each character until we hit the scan boundary */
    for_ever {
	int startoff, srchlim;

	if (interrupted()) {
	    if (wrappedp)
		*wrappedp = wrapped;
	    returnCode(ABORT);
	}

	if (sameline(curpos, scanboundpos)) {
	    if (scanbound_is_header) {
		/* if we're on the header, nothing can match */
		found = FALSE;
		srchlim = leftmargin;
	    } else {
		if (direct == FORWARD) {
		    if (wrapped) {
			startoff = curpos.o;
			srchlim = scanboundpos.o;
		    } else {
			startoff = curpos.o;
			srchlim = ((scanboundpos.o > startoff)
				   ? scanboundpos.o
				   : llength(curpos.l));
		    }
		} else {
		    if (wrapped) {
			startoff = scanboundpos.o;
			srchlim = llength(curpos.l);
		    } else {
			startoff = leftmargin;
			srchlim = scanboundpos.o + 1;
		    }
		}
		found = lregexec(exp, curpos.l, startoff, srchlim);
	    }
	} else {
	    if (direct == FORWARD) {
		startoff = curpos.o;
		srchlim = llength(curpos.l);
	    } else {
		startoff = leftmargin;
		srchlim = curpos.o + 1;
		if (srchlim > llength(curpos.l))
		    srchlim = llength(curpos.l);
	    }
	    found = lregexec(exp, curpos.l, startoff, srchlim);
	}
	if (found) {
	    char *txt = lvalue(curpos.l);
	    char *got = exp->startp[0];
	    C_NUM next;
	    C_NUM last = curpos.o;

	    if (direct == REVERSE) {	/* find the last one */
		int end = FALSE;
		char *tst = 0;

		last++;
		while (testit(curpos.l, exp, &end, srchlim)) {
		    got = exp->startp[0];
		    /* guard against infinite loop:  "?$"
		     * or "?.*"
		     */
		    if (tst == got)
			break;
		    tst = got;
		}
		if (end)
		    last++;
		if (!lregexec(exp, curpos.l, (int) (got - txt), srchlim)) {
		    mlforce("BUG: prev. match no good");
		    returnCode(FALSE);
		}
	    } else if (llength(curpos.l) <= leftmargin
		       || last < llength(curpos.l)) {
		last--;
	    }
	    next = (C_NUM) (got - txt);
	    if (next != last) {
		DOT.l = curpos.l;
		DOT.o = next;
		curwp->w_flag |= WFMOVE;	/* flag that we have moved */
		if (wrappedp)
		    *wrappedp = wrapped;
#if OPT_TRACE
		trace_mark("...scanner", &DOT, curbp);
#endif
		returnCode(TRUE);
	    }
	} else {
	    if (sameline(curpos, scanboundpos) &&
		(!wrapok || wrapped))
		break;
	}
	if (direct == FORWARD) {
	    curpos.l = lforw(curpos.l);
	} else {
	    curpos.l = lback(curpos.l);
	}
	if (is_header_line(curpos, curbp)) {
	    wrapped = TRUE;
	    if (sameline(curpos, scanboundpos) &&
		(!wrapok || wrapped))
		break;
	    if (direct == FORWARD)
		curpos.l = lforw(curpos.l);
	    else
		curpos.l = lback(curpos.l);
	}
	if (direct == FORWARD) {
	    curpos.o = leftmargin;
	} else {
	    if ((curpos.o = llength(curpos.l) - 1) < leftmargin)
		curpos.o = leftmargin;
	}

    }

    if (wrappedp)
	*wrappedp = wrapped;
    returnCode(FALSE);		/* We could not find a match. */
}
示例#28
0
int main(int argc, char *argv[])
{
	int c;
	struct option long_options[] = {
		/* Options/Commands */
		{"clear",             0, 0, 'c'},
		{"disable",           0, 0, 'd'},
		{"enable",            0, 0, 'e'},
		{"force-reset",       0, 0, 'f'},
		{"loglevel",          1, 0, 'l'},
		{"help",              0, 0, 'h'},
		{"reboot",            1, 0, 'r'},
		{"status",            0, 0, 's'},
		{"verbose",           0, 0, 'V'},
		{"version",           0, 0, 'v'},
		/* Tests */
		{"complete-cycle",    0, 0, 200},
		{"disable-enable",    0, 0, 201},
		{"false-ack",         0, 0, 202},
		{"false-unsubscribe", 0, 0, 203},
		{"failed-kick",       0, 0, 204},
		{"no-kick",           0, 0, 205},
		{"premature-trigger", 0, 0, 206},
		{NULL, 0, 0, 0}
	};

	while ((c = getopt_long(argc, argv, "cdefl:hr:sVv?", long_options, NULL)) != EOF) {
		switch (c) {
		case 'c':
			return do_clear();

		case 'd':
			return do_enable(0);

		case 'e':
			return do_enable(1);

		case 'f':
			return do_reset(0);

		case 'l':
			return set_loglevel(optarg);

		case 'h':
			return usage(0);

		case 'r':
			return do_reset(atoi(optarg));

		case 's':
			return show_status();

		case 'V':
			verbose = 1;
			break;

		case 'v':
			return show_version();

		case 200:
			return testit();

		case 201:
			disable_enable = 1;
			return testit();

		case 202:
			false_ack = 1;
			return testit();

		case 203:
			false_unsubscribe = 1;
			return testit();

		case 204:
			failed_kick = 1;
			return testit();

		case 205:
			no_kick = 1;
			return testit();

		case 206:
			premature = 1;
			return testit();

		default:
			warn("Unknown or currently unsupported.");
			return usage(1);
		}
	}

	return 0;
}
示例#29
0
int
main (int argc, char *argv[])
{
  const char *globfile[] = { "one", "two", "three", NULL };
  char tmpdir[32];
  struct passwd *pw;
  const char *cwd;
  int test;
  int fail = 0;
  int i;
  struct test_case_struct ts;

  if (argc > 1)
    {
      command_line_test (argv[1]);
      return 0;
    }

  cwd = getcwd (NULL, 0);

  /* Set up arena for pathname expansion */
  tmpnam (tmpdir);
  if (mkdir (tmpdir, S_IRWXU) || chdir (tmpdir))
    return -1;
  else
    {
      int fd;

      for (i = 0; globfile[i]; ++i)
	if ((fd = creat (globfile[i], S_IRUSR | S_IWUSR)) == -1
	    || close (fd))
	  return -1;
    }

  /* If we are not allowed to do command substitution, we install
     fork handlers to verify that no forks happened.  No forks should
     happen at all if command substitution is disabled.  */
  if (__app_register_atfork (register_fork, NULL, NULL) != 0)
    {
      printf ("Failed to register fork handler.\n");
      return -1;
    }

  for (test = 0; test_case[test].retval != -1; test++)
    if (testit (&test_case[test]))
      ++fail;

  /* Tilde-expansion tests. */
  pw = getpwnam ("root");
  if (pw != NULL)
    {
      ts.retval = 0;
      ts.env = NULL;
      ts.words = "~root ";
      ts.flags = 0;
      ts.wordc = 1;
      ts.wordv[0] = pw->pw_dir;
      ts.ifs = IFS;

      if (testit (&ts))
	++fail;

      ts.retval = 0;
      ts.env = pw->pw_dir;
      ts.words = "${var#~root}x";
      ts.flags = 0;
      ts.wordc = 1;
      ts.wordv[0] = "x";
      ts.ifs = IFS;

      if (testit (&ts))
	++fail;
    }

  /* "~" expands to value of $HOME when HOME is set */

  setenv ("HOME", "/dummy/home", 1);
  ts.retval = 0;
  ts.env = NULL;
  ts.words = "~ ~/foo";
  ts.flags = 0;
  ts.wordc = 2;
  ts.wordv[0] = "/dummy/home";
  ts.wordv[1] = "/dummy/home/foo";
  ts.ifs = IFS;

  if (testit (&ts))
    ++fail;

  /* "~" expands to home dir from passwd file if HOME is not set */

  pw = getpwuid (getuid ());
  if (pw != NULL)
    {
      unsetenv ("HOME");
      ts.retval = 0;
      ts.env = NULL;
      ts.words = "~";
      ts.flags = 0;
      ts.wordc = 1;
      ts.wordv[0] = pw->pw_dir;
      ts.ifs = IFS;

      if (testit (&ts))
	++fail;
    }

  puts ("tests completed, now cleaning up");

  /* Clean up */
  for (i = 0; globfile[i]; ++i)
    remove (globfile[i]);

  if (cwd == NULL)
    cwd = "..";

  chdir (cwd);
  rmdir (tmpdir);

  printf ("tests failed: %d\n", fail);

  return fail != 0;
}
示例#30
0
int main(int argc, char** args) {
    int argchar;
	int* flatwanted;
	int Nwanted;
	int itemsize;
	int i;

	while ((argchar = getopt(argc, args, OPTIONS)) != -1)
		switch (argchar) {
        case 'v':
            log_init(LOG_ALL+1);
            break;
        }

	// NOTE, contain duplicates because of parity (we're trying both)
    int wanted3[][3] = {
		{0,1,3}, {1,0,3}, {0,1,3}, {1,0,3}, {0,2,3}, {2,0,3}, {0,2,3}, {2,0,3}, {1,2,3}, {2,1,3}, {1,2,3}, {2,1,3}, {2,4,3}, {4,2,3}, {2,4,3}, {4,2,3}, {0,1,4}, {1,0,4}, {0,1,4}, {1,0,4}, {0,2,4}, {2,0,4}, {0,2,4}, {2,0,4}, {0,3,4}, {3,0,4}, {0,3,4}, {3,0,4}, {1,2,4}, {2,1,4}, {1,2,4}, {2,1,4}, {1,3,4}, {3,1,4}, {1,3,4}, {3,1,4}, {0,5,4}, {5,0,4}, {0,5,4}, {5,0,4}, {1,5,4}, {5,1,4}, {1,5,4}, {5,1,4}, {2,5,0}, {5,2,0}, {2,5,0}, {5,2,0}, {2,5,1}, {5,2,1}, {2,5,1}, {5,2,1}, {2,5,3}, {5,2,3}, {2,5,3}, {5,2,3}, {2,5,4}, {5,2,4}, {2,5,4}, {5,2,4}, {3,5,4}, {5,3,4}, {3,5,4}, {5,3,4}, {0,1,5}, {1,0,5}, {0,1,5}, {1,0,5}, {0,6,4}, {6,0,4}, {0,6,4}, {6,0,4}, {0,6,5}, {6,0,5}, {0,6,5}, {6,0,5}, {1,6,4}, {6,1,4}, {1,6,4}, {6,1,4}, {1,6,5}, {6,1,5}, {1,6,5}, {6,1,5}, {2,6,0}, {6,2,0}, {2,6,0}, {6,2,0}, {2,6,1}, {6,2,1}, {2,6,1}, {6,2,1}, {2,6,3}, {6,2,3}, {2,6,3}, {6,2,3}, {2,6,4}, {6,2,4}, {2,6,4}, {6,2,4}, {2,6,5}, {6,2,5}, {2,6,5}, {6,2,5}, {3,6,0}, {6,3,0}, {3,6,0}, {6,3,0}, {3,6,1}, {6,3,1}, {3,6,1}, {6,3,1}, {3,6,4}, {6,3,4}, {3,6,4}, {6,3,4}, {3,6,5}, {6,3,5}, {3,6,5}, {6,3,5}, {4,6,5}, {6,4,5}, {4,6,5}, {6,4,5},
	};
    int wanted4[][4] = {
		{0, 1, 4, 3}, {0, 1, 3, 4}, {1, 0, 4, 3}, {1, 0, 3, 4}, {0, 1, 4, 3}, {0, 1, 3, 4}, {1, 0, 4, 3}, {1, 0, 3, 4}, {0, 2, 4, 3}, {0, 2, 3, 4}, {2, 0, 4, 3}, {2, 0, 3, 4}, {0, 2, 4, 3}, {0, 2, 3, 4}, {2, 0, 4, 3}, {2, 0, 3, 4}, {1, 2, 4, 3}, {1, 2, 3, 4}, {2, 1, 4, 3}, {2, 1, 3, 4}, {1, 2, 4, 3}, {1, 2, 3, 4}, {2, 1, 4, 3}, {2, 1, 3, 4}, {2, 5, 0, 1}, {2, 5, 1, 0}, {5, 2, 0, 1}, {5, 2, 1, 0}, {2,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,6,1,4,0}, {3,6,4,0,1}, {3,6,4,1,0}, {6,3,0,1,4}, {6,3,0,4,1}, {6,3,1,0,4}, {6,3,1,4,0}, {6,3,4,0,1}, {6,3,4,1,0}, {3,6,0,1,5}, {3,6,0,5,1}, {3,6,1,0,5}, {3,6,1,5,0}, {3,6,5,0,1}, {3,6,5,1,0}, {6,3,0,1,5}, {6,3,0,5,1}, {6,3,1,0,5}, {6,3,1,5,0}, {6,3,5,0,1}, {6,3,5,1,0}, {3,6,0,1,5}, {3,6,0,5,1}, {3,6,1,0,5}, {3,6,1,5,0}, {3,6,5,0,1}, {3,6,5,1,0}, {6,3,0,1,5}, {6,3,0,5,1}, {6,3,1,0,5}, {6,3,1,5,0}, {6,3,5,0,1}, {6,3,5,1,0}, {3,6,0,4,5}, {3,6,0,5,4}, {3,6,4,0,5}, {3,6,4,5,0}, {3,6,5,0,4}, {3,6,5,4,0}, {6,3,0,4,5}, {6,3,0,5,4}, {6,3,4,0,5}, {6,3,4,5,0}, {6,3,5,0,4}, {6,3,5,4,0}, {3,6,0,4,5}, {3,6,0,5,4}, {3,6,4,0,5}, {3,6,4,5,0}, {3,6,5,0,4}, {3,6,5,4,0}, {6,3,0,4,5}, {6,3,0,5,4}, {6,3,4,0,5}, {6,3,4,5,0}, {6,3,5,0,4}, {6,3,5,4,0}, {3,6,1,4,5}, {3,6,1,5,4}, {3,6,4,1,5}, {3,6,4,5,1}, {3,6,5,1,4}, {3,6,5,4,1}, {6,3,1,4,5}, {6,3,1,5,4}, {6,3,4,1,5}, {6,3,4,5,1}, {6,3,5,1,4}, {6,3,5,4,1}, {3,6,1,4,5}, {3,6,1,5,4}, {3,6,4,1,5}, {3,6,4,5,1}, {3,6,5,1,4}, {3,6,5,4,1}, {6,3,1,4,5}, {6,3,1,5,4}, {6,3,4,1,5}, {6,3,4,5,1}, {6,3,5,1,4}, {6,3,5,4,1}
	};

	itemsize = 4*sizeof(int);
	Nwanted = sizeof(wanted4) / itemsize;
	flatwanted = calloc(Nwanted, itemsize);
	for (i=0; i<Nwanted; i++) {
		memcpy(flatwanted+i*4, wanted4[i], itemsize);
		//qsort(flatwanted+i*4, 2, sizeof(int), compare_ints_asc);
		//qsort(sorted+2, dimquad-2, sizeof(int), compare_ints_asc);
	}
	testit(flatwanted, Nwanted, 4, compare_quad, FALSE);
	free(flatwanted);

	itemsize = 5*sizeof(int);
	Nwanted = sizeof(wanted5) / itemsize;
	flatwanted = calloc(Nwanted, itemsize);
	for (i=0; i<Nwanted; i++)
		memcpy(flatwanted+i*5, wanted5[i], itemsize);
	testit(flatwanted, Nwanted, 5, compare_quint, FALSE);
	free(flatwanted);

	itemsize = 3*sizeof(int);
	Nwanted = sizeof(wanted3) / itemsize;
	flatwanted = calloc(Nwanted, itemsize);
	for (i=0; i<Nwanted; i++)
		memcpy(flatwanted+i*3, wanted3[i], itemsize);
	testit(flatwanted, Nwanted, 3, compare_tri, FALSE);
	free(flatwanted);

	int wanted3b[][3] = {
		{0,1,3}, {1,0,3}, {2,0,3}, {0,2,3}, {1,2,3}, {2,1,3}, {4,2,3}, {4,2,3}, {0,1,4}, {1,0,4}, {0,1,4}, {1,0,4}, {2,0,4}, {0,2,4}, {3,0,4}, {0,3,4}, {1,2,4}, {2,1,4}, {1,3,4}, {3,1,4}, {0,5,4}, {5,0,4}, {5,1,4}, {1,5,4}, {5,2,0}, {2,5,0}, {2,5,1}, {5,2,1}, {5,2,3}, {5,2,3}, {5,2,4}, {5,2,4}, {3,5,4}, {5,3,4}, {3,5,4}, {5,3,4}, {1,0,5}, {0,1,5}, {0,6,4}, {6,0,4}, {0,6,5}, {6,0,5}, {6,1,4}, {1,6,4}, {6,1,5}, {1,6,5}, {6,2,0}, {2,6,0}, {2,6,1}, {6,2,1}, {2,6,3}, {2,6,3}, {2,6,4}, {6,2,4}, {2,6,4}, {6,2,4}, {6,2,5}, {6,2,5}, {6,3,0}, {3,6,0}, {3,6,1}, {6,3,1}, {3,6,4}, {3,6,4}, {3,6,5}, {3,6,5}, {4,6,5}, {4,6,5}
	 };
	int wanted5b[][5] = {
		{5,2,0,3,1}, {5,2,1,3,0}, {5,2,0,4,1}, {5,2,1,4,0}, {5,2,0,4,3}, {5,2,4,3,0}, {5,2,4,3,1}, {5,2,1,4,3}, {0,1,3,4,5}, {1,0,5,4,3}, {0,1,5,4,3}, {1,0,3,4,5}, {2,6,1,3,0}, {2,6,0,3,1}, {2,6,1,4,0}, {6,2,0,4,1}, {2,6,0,4,1}, {6,2,1,4,0}, {6,2,0,5,1}, {6,2,1,5,0}, {6,2,0,4,3}, {2,6,0,3,4}, {6,2,0,5,3}, {2,6,0,3,5}, {6,2,0,5,4}, {2,6,0,4,5}, {2,6,1,3,4}, {6,2,1,4,3}, {2,6,1,3,5}, {6,2,1,5,3}, {2,6,1,4,5}, {6,2,1,5,4}, {2,6,3,4,5}, {6,2,5,4,3}, {2,6,3,4,5}, {6,2,5,4,3}, {3,6,1,4,0}, {3,6,0,4,1}, {3,6,1,5,0}, {3,6,0,5,1}, {3,6,4,5,0}, {3,6,0,4,5}, {3,6,1,4,5}, {3,6,4,5,1}, 
	 };
	int wanted4b[][4] = {
		{0,1,3,4}, {1,0,3,4}, {2,0,3,4}, {0,2,4,3}, {1,2,4,3}, {2,1,3,4}, {5,2,0,1}, {5,2,1,0}, {5,2,0,3}, {2,5,0,3}, {5,2,3,0}, {5,2,0,4}, {5,2,4,0}, {2,5,1,3}, {5,2,3,1}, {5,2,1,3}, {5,2,4,1}, {5,2,1,4}, {5,2,4,3}, {5,2,4,3}, {0,1,3,5}, {1,0,5,3}, {0,1,5,3}, {1,0,3,5}, {1,0,5,4}, {0,1,5,4}, {0,6,4,5}, {6,0,5,4}, {6,1,5,4}, {1,6,4,5}, {2,6,1,0}, {6,2,0,1}, {2,6,0,1}, {6,2,1,0}, {6,2,0,3}, {2,6,0,3}, {6,2,0,4}, {2,6,0,4}, {6,2,0,5}, {2,6,0,5}, {2,6,1,3}, {6,2,1,3}, {2,6,1,4}, {6,2,1,4}, {2,6,1,5}, {6,2,1,5}, {2,6,3,4}, {2,6,3,4}, {2,6,3,5}, {6,2,5,3}, {2,6,3,5}, {6,2,5,3}, {6,2,5,4}, {6,2,5,4}, {3,6,1,0}, {3,6,0,1}, {3,6,4,0}, {3,6,0,4}, {3,6,5,0}, {6,3,0,5}, {3,6,0,5}, {3,6,1,4}, {3,6,4,1}, {3,6,1,5}, {3,6,5,1}, {6,3,1,5}, {3,6,4,5}, {3,6,4,5}
	};

	itemsize = 4*sizeof(int);
	Nwanted = sizeof(wanted4b) / itemsize;
	flatwanted = calloc(Nwanted, itemsize);
	for (i=0; i<Nwanted; i++) {
		memcpy(flatwanted+i*4, wanted4b[i], itemsize);
	}
	testit(flatwanted, Nwanted, 4, compare_quad, TRUE);
	free(flatwanted);

	itemsize = 3*sizeof(int);
	Nwanted = sizeof(wanted3b) / itemsize;
	flatwanted = calloc(Nwanted, itemsize);
	for (i=0; i<Nwanted; i++) {
		memcpy(flatwanted+i*3, wanted3b[i], itemsize);
	}
	testit(flatwanted, Nwanted, 3, compare_tri, TRUE);
	free(flatwanted);

	itemsize = 5*sizeof(int);
	Nwanted = sizeof(wanted5b) / itemsize;
	flatwanted = calloc(Nwanted, itemsize);
	for (i=0; i<Nwanted; i++) {
		memcpy(flatwanted+i*5, wanted5b[i], itemsize);
	}
	testit(flatwanted, Nwanted, 5, compare_quint, TRUE);
	free(flatwanted);


    return 0;
}