Exemple #1
0
int
main( void )
{
    const testFunc tests[] = {
	test_base64, test_hex, test_lowerbound, test_strip_positional_args,
	test_strstrip, test_buildpath, test_utf8, test_numbers, test_memmem,
	test_array, test_url, test_truncd, test_cryptoRand,
    };
    int   ret;
    int   l;

    if( (ret = runTests(tests, NUM_TESTS(tests))) )
	return ret;

    /* simple bitfield tests */
    for( l = 0; l < NUM_LOOPS; ++l )
        if( ( ret = test_bitfields( ) ) )
            return ret;

    /* bitfield count range */
    for( l=0; l<10000; ++l )
        if(( ret = test_bitfield_count_range( )))
            return ret;

    return 0;
}
Exemple #2
0
int
main (void)
{
  const testFunc tests[] = { test_single_file,
                             test_single_directory_random_payload };

  return runTests (tests, NUM_TESTS (tests));
}
Exemple #3
0
int
main (void)
{
  const testFunc tests[] = { test_error_set,
                             test_error_propagate };

  return runTests (tests, NUM_TESTS (tests));
}
Exemple #4
0
int
main (void)
{
  const testFunc tests[] = { testPeerId,
                             test_session_id };

  return runTests (tests, NUM_TESTS (tests));
}
Exemple #5
0
int
main (void)
{
  const testFunc tests[] = { test_parsing,
                             test_updating };

  return runTests (tests, NUM_TESTS (tests));
}
Exemple #6
0
int
main (void)
{
  const testFunc tests[] = { test_magnet_link,
                             test_metainfo };

  return runTests (tests, NUM_TESTS (tests));
}
Exemple #7
0
int main(void)
{
    char const* comma_locales[] =
    {
        "da_DK.UTF-8",
        "fr_FR.UTF-8",
        "ru_RU.UTF-8"
    };

    testFunc const tests[] =
    {
        test_elements,
        test_utf8,
        test1,
        test2,
        test3,
        test_unescape
    };

    /* run the tests in a locale with a decimal point of '.' */
    setlocale(LC_NUMERIC, "C");

    int ret = runTests(tests, NUM_TESTS(tests));

    /* run the tests in a locale with a decimal point of ',' */
    bool is_locale_set = false;

    for (size_t i = 0; !is_locale_set && i < TR_N_ELEMENTS(comma_locales); ++i)
    {
        is_locale_set = setlocale(LC_NUMERIC, comma_locales[i]) != NULL;
    }

    if (!is_locale_set)
    {
        fprintf(stderr, "WARNING: unable to run locale-specific json tests. add a locale like %s or %s\n", comma_locales[0],
            comma_locales[1]);
    }
    else
    {
        ret += runTests(tests, NUM_TESTS(tests));
    }

    return ret;
}
Exemple #8
0
int
main (void)
{
  const testFunc tests[] = { test_torrent_hash,
                             test_encrypt_decrypt,
                             test_sha1,
                             test_ssha1 };

  return runTests (tests, NUM_TESTS (tests));
}
Exemple #9
0
int
main( void )
{
    static const testFunc tests[] = {
	testInt, testStr, testParse, testJSON, testMerge, testBool,
	testParse2, testStackSmash,
    };

    return runTests(tests, NUM_TESTS(tests));
}
Exemple #10
0
int
main (void)
{
  int i;
  int n;
  int rv;

  const char * comma_locales[] = { "da_DK.UTF-8",
                                   "fr_FR.UTF-8",
                                   "ru_RU.UTF-8"};

  const testFunc tests[] = { test_elements,
                             test_utf8,
                             test1,
                             test2,
                             test3,
                             test_unescape };

  /* run the tests in a locale with a decimal point of '.' */
  setlocale (LC_NUMERIC, "C");
  if ((rv = runTests (tests, NUM_TESTS (tests))))
    return rv;

  /* run the tests in a locale with a decimal point of ',' */
  n = sizeof(comma_locales) / sizeof(comma_locales[0]);
  for (i=0; i<n; ++i)
    if (setlocale (LC_NUMERIC, comma_locales[i]) != NULL)
      break;
  if (i==n)
    fprintf (stderr, "WARNING: unable to run locale-specific json tests. add a locale like %s or %s\n",
             comma_locales[0],
             comma_locales[1]);
  else if ((rv = runTests (tests, NUM_TESTS(tests))))
    return rv;

  /* success */
  return 0;
}
int
main (void)
{
  int l;
  int ret;
  const testFunc tests[] = { test_bitfields };

  if ((ret = runTests (tests, NUM_TESTS (tests))))
    return ret;

  /* bitfield count range */
  for (l=0; l<10000; ++l)
    if ((ret = test_bitfield_count_range ()))
      return ret;

  return 0;
}
Exemple #12
0
int
main (void)
{
  const testFunc tests[] = { test_no_options,
                             test_short_noarg,
                             test_long_noarg,
                             test_short_with_arg,
                             test_long_with_arg,
                             test_short_with_arg_after_eq,
                             test_long_with_arg_after_eq,
                             test_unknown_option,
                             test_missing_arg,
                             test_match_longer_key,
                             test_lots_of_options };

  return runTests (tests, NUM_TESTS (tests));
}
Exemple #13
0
int
main (void)
{
  const testFunc tests[] = { test_array,
                             test_buildpath,
                             test_hex,
                             test_lowerbound,
                             test_quickfindFirst,
                             test_memmem,
                             test_numbers,
                             test_strip_positional_args,
                             test_strdup_printf,
                             test_strstrip,
                             test_truncd,
                             test_url,
                             test_utf8,
                             test_env };

  return runTests (tests, NUM_TESTS (tests));
}