int main () { test_ascii (u8_is_titlecase); return 0; }
int main(int argc, char **argv) { if (allegro_init() != 0) return 1; install_keyboard(); if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 200, 0, 0) != 0) { if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Unable to set any graphics mode:\n" "%s\n", allegro_error); return 1; } } black = makecol(0,0,0); white = makecol(255,255,255); clear_to_color(screen, black); test_unicode(); readkey(); set_uformat(U_ASCII); clear_to_color(screen, black); test_cp437(); readkey(); clear_to_color(screen, black); test_ascii(); readkey(); return 0; }
int main (int argc, char *argv[]) { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; test_ascii (mbmemcasecmp); if (argc > 1) switch (argv[1][0]) { case '1': /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ test_iso_8859_1 (mbmemcasecmp, true); return 0; case '2': /* Locale encoding is UTF-8, locale is not Turkish. */ test_utf_8 (mbmemcasecmp, false); return 0; case '3': /* Locale encoding is UTF-8, locale is Turkish. */ test_utf_8 (mbmemcasecmp, true); return 0; } return 1; }
/* This function coordinates the test for each filesystem type. */ static void test_filesystem (guestfs_h *g, const struct filesystem *fs) { if (fs->fs_feature && !feature_available (g, fs->fs_feature)) { printf ("skipped test of %s because %s feature not available\n", fs->fs_name, fs->fs_feature); return; } printf ("testing charset fidelity on %s\n", fs->fs_name); make_filesystem (g, fs); mount_filesystem (g, fs); test_ascii (g, fs); if (fs->fs_8bit_only) goto out; if (!fs->fs_skip_latin1) test_latin1 (g, fs); if (!fs->fs_skip_latin2) test_latin2 (g, fs); test_chinese (g, fs); out: unmount_filesystem (g, fs); }
int main () { test_ascii (u16_is_cased); return 0; }
int main () { test_ascii (u32_is_lowercase); test_nonascii (u32_is_lowercase); return 0; }
int main () { test_ascii (u8_is_uppercase); test_nonascii (u8_is_uppercase); return 0; }
int main () { test_ascii (u32_normcmp, UNINORM_NFD); test_nonascii (u32_normcmp); return 0; }
int main () { test_ascii (u8_is_casefolded); test_nonascii (u8_is_casefolded); return 0; }
int main () { test_ascii (u8_casecmp, UNINORM_NFD); test_nonascii (u8_casecmp); return 0; }
int main () { /* In the "C" locale, strcoll is equivalent to strcmp, therefore u8_casecoll on ASCII strings should behave like strcasecmp. */ test_ascii (u8_casecoll, UNINORM_NFC); return 0; }
int main () { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) return 1; /* In the "C" locale, strcoll is equivalent to strcmp, therefore u8_casecoll on ASCII strings should behave like strcasecmp. */ test_ascii (ulc_casecoll, UNINORM_NFC); return 0; }
/* This function coordinates the test for each filesystem type. */ static void test_filesystem (guestfs_h *g, const struct filesystem *fs) { const char *feature[] = { fs->fs_feature, NULL }; char envvar[sizeof (ourenvvar) + 20]; char *str; if (fs->fs_feature && !guestfs_feature_available (g, (char **) feature)) { printf ("skipped test of %s because %s feature not available\n", fs->fs_name, fs->fs_feature); return; } snprintf (envvar, sizeof envvar, "%s_%s", ourenvvar, fs->fs_name); str = getenv (envvar); if (str && STREQ (str, "1")) { printf ("skipped test of %s because environment variable is set\n", fs->fs_name); return; } printf ("testing charset fidelity on %s\n", fs->fs_name); make_filesystem (g, fs); mount_filesystem (g, fs); test_ascii (g, fs); if (fs->fs_8bit_only) goto out; if (!fs->fs_skip_latin1) test_latin1 (g, fs); if (!fs->fs_skip_latin2) test_latin2 (g, fs); test_chinese (g, fs); out: unmount_filesystem (g, fs); }
/**** Global functions definitions. ****/ int main( int argc, char **argv ) { ErrorNumber retValue; (void)argv; printf( "\n" ); printf( "ta_regtest V%s - Regression Tests of TA-Lib code\n", TA_GetVersionString() ); printf( "\n" ); if( argc > 1 ) { printf( "Usage: ta_regtest\n" ); printf( "\n" ); printf( " No parameter needed.\n" ); printf( "\n" ); printf( " This tool will execute a series of tests to\n" ); printf( " make sure that the library is behaving as\n" ); printf( " expected.\n\n"); printf( " ** Must be run from the 'bin' directory.\n\n" ); printf( " On success, the exit code is 0.\n" ); printf( " On failure, the exit code is a number that can be\n" ); printf( " found in c/src/tools/ta_regtest/ta_error_number.h\n" ); return TA_REGTEST_BAD_USER_PARAM; } /* Some tests are using randomness. */ srand( (unsigned)time( NULL ) ); /* Test utility like List/Stack/Dictionary/Memory Allocation etc... */ retValue = test_internals(); if( retValue != TA_TEST_PASS ) { printf( "Failed internal cricular buffer test with code=%d\n", retValue ); return retValue; } /* Test the CSI data source. */ retValue = test_csi(); if( retValue != TA_TEST_PASS ) return retValue; /* Test Performance Measurements. */ retValue = test_pm(); if( retValue != TA_TEST_PASS ) { printf( "Failed: Performance Measurements Tests (error number = %d)\n", retValue ); return retValue; } /* Test abstract interface. */ retValue = test_abstract(); if( retValue != TA_TEST_PASS ) { printf( "Failed: Abstract interface Tests (error number = %d)\n", retValue ); return retValue; } /* Test history alloc. */ retValue = testHistoryAlloc(); if( retValue != TA_TEST_PASS ) { printf( "Failed TA_HistoryAlloc test with code=%d\n", retValue ); return retValue; } /* Test the ASCII data source. */ retValue = test_ascii(); if( retValue != TA_TEST_PASS ) return retValue; /* Perform all the tests using the TA_SIMULATOR data */ retValue = test_with_simulator(); if( retValue != TA_TEST_PASS ) return retValue; /* Test the merging of multiple data source */ retValue = test_datasource_merge(); if( retValue != TA_TEST_PASS ) return retValue; /* Test the Yahoo! data source. */ retValue = test_yahoo(); if( retValue != TA_TEST_PASS ) return retValue; printf( "\n* All tests succeed. Enjoy the library. *\n" ); return TA_TEST_PASS; /* Everything succeed !!! */ }