Пример #1
0
int main(int argc, char* argv[])
{

	if(argc < 2 || strcmp(argv[1], "--help") == 0)
	{
		MMS_PRINTF("usage: %s test_from_file file\n", argv[0]);
		MMS_PRINTF("usage: %s test_unpack mms\n", argv[0]);
		MMS_PRINTF("usage: %s test_get_set\n", argv[0]);
		
		return -1;
	}

	if(strcmp(argv[1], "test_get_set") == 0)
	{
		test_get_set();
	}
	else if(strcmp(argv[1], "test_unpack") == 0)
	{
		test_unpack(argv[2]);
	}
	else if(strcmp(argv[1], "test_from_file") == 0)
	{
		test_from_file(argv[2]);
	}

	return 0;
}
Пример #2
0
int main(void) {
    bool err = false;

    setup();
    err |= test_put_resource();
    err |= test_combine_databases();
    err |= test_from_file();
    cleanup();

    return err;
}
Пример #3
0
int
main(int ac, char *av[]) {
  char **ia = av + 1, **a_end = av + ac, *ep;
  const char *fname = NULL;

  for (; ia < a_end; ++ia) {
    if (!strcmp("--fp-len", *ia))               s_fp_len = atoi(*++ia);
    else if (!strcmp("--offset", *ia))          s_offset = atoi(*++ia);
    else if (!strcmp("--times", *ia))           s_times = atoi(*++ia);
    else if (!strcmp("--hash", *ia))            s_show_hash = 1;
    else if (!strcmp("--b1", *ia))              s_b1 = atoi(*++ia);
    else if (!strcmp("--b2", *ia))              s_b2 = atoi(*++ia);
    else if (!strcmp("--m", *ia))               s_m = strtol(*++ia, &ep, 0);
    else if (!strcmp("--m1", *ia))              s_m1 = strtol(*++ia, &ep, 0);
    else if (!strcmp("--m2", *ia))              s_m2 = strtol(*++ia, &ep, 0);
    else if (!strcmp("--file", *ia))            fname = *++ia;
    else if (!strcmp("--no-mmap", *ia))         s_no_mmap = 1;
    else if (!strcmp("--verbose", *ia))         s_verbosity = 1;
    else if (!strncmp("--verbose=", *ia, 10))   s_verbosity = atoi(*ia + 10);
    else if (!strcmp("--bm-dump", *ia))         s_bm_dump = 1;
    else if (!strcmp("--bench-hash", *ia))      s_options |= O_BENCH_HASH;
    else if (!strcmp("--check-hash", *ia))      s_options |= O_CHECK_HASH;
    else if (!strcmp("--bench-lut", *ia))       s_options |= O_BENCH_LUT;
    else if (!strcmp("--hash-mod", *ia))        s_options |= O_HASH_MOD;
    else if (!strcmp("--hash-mod16x2", *ia))    s_options |= O_HASH_MOD16X2;
    else if (!strcmp("--hash-mask16x2", *ia))   s_options |= O_HASH_MASK16X2;
    else if (!strcmp("--hash-mask", *ia))       s_options |= O_HASH_MASK;
    else if (!strcmp("--hash-mask32x2", *ia))   s_options |= O_HASH_MASK32X2;
    else if (!strcmp("--help", *ia))            show_usage();
    else if (!strcmp("--", *ia)) {
      ++ia;
      break;
    }
    else if ('-' == **ia) {
      DIE("unknown option: %s\n", *ia);
    }
    else break;
  }
  bmz_set_verbosity(s_verbosity);

  if (!s_options) s_options = O_DEFAULT;
  else if (!(s_options & O_HASHES)) s_options |= O_HASHES;

  if (fname)
    test_from_file(fname);
  else if (ia >= a_end)
    test_from_stdin();
  else for (; ia < a_end; ++ia)
    test_from_string(*ia, strlen(*ia));

  return 0;
}