コード例 #1
0
ファイル: call-test.c プロジェクト: liu4lin/libspiro
int main(int argc, char **argv) {
    double st, en;
    int ret;
    st = get_time();

#ifdef DO_CALL_TEST0
    ret=test_curve(0);
#endif
#ifdef DO_CALL_TEST1
    ret=test_curve(1);
#endif
#ifdef DO_CALL_TEST2
    ret=test_curve(2);
#endif
#ifdef DO_CALL_TEST3
    if ( (ret=test_curve(3)==0) ) /* This curve will not converge */
	ret = -1 /* error found! ret=error value */;
    else
	ret = 0; /* expected failure to converge */
#endif
#ifdef DO_CALL_TESTM
    ret=test_multi_curves();
#endif

    en = get_time();
    printf("time %g\n", (en - st));
    return ret;
}
コード例 #2
0
ファイル: call-test.c プロジェクト: UIKit0/libspiro
int main(int argc, char **argv) {
    double st, en;
    int ret = 0;
    st = get_time();

    if ( test_curve(0) || test_curve(1) || test_curve(2) || \
	 !test_curve(3) || /* This curve won't converge. */ \
    	 test_multi_curves() )
	ret = -1;

    en = get_time();
    printf("time %g\n", (en - st));
    return ret;
}
コード例 #3
0
/*-------------------------------------------------------------------------
 * Function:	main
 *
 * Purpose:	
 *
 * Return:	Success:	
 *
 *		Failure:	
 *
 * Programmer:	Robb Matzke
 *              Tuesday, February  9, 1999
 *
 * Modifications:
 *    Eric Brugger, Fri Apr 14 09:30:47 PDT 2000
 *    I modified the routine to not perform some tests that are not valid
 *    when using the PDB driver.  There was already code to not do those
 *    tests when using the pdb driver but it wasn't quite correct.
 *
 *-------------------------------------------------------------------------
 */
int
main(int argc, char *argv[])
{
    DBfile		*dbfile;
    int			i, nerrors=0,  driver=DB_PDB;
    char		*filename="sami.pdb";
    
    for (i=1; i<argc; i++) {
	if (!strcmp(argv[i], "DB_PDB")) {
	    driver = DB_PDB;
	    filename = "sami.pdb";
	} else if (!strcmp(argv[i], "DB_HDF5")) {
	    driver = DB_HDF5;
	    filename = "sami.h5";
	} else if (!strcmp(argv[i], "DB_LOCAL")) {
	    arch_g = DB_LOCAL;
	} else if (!strcmp(argv[i], "DB_SUN3")) {
	    arch_g = DB_SUN3;
	} else if (!strcmp(argv[i], "DB_SUN4")) {
	    arch_g = DB_SUN4;
	} else if (!strcmp(argv[i], "DB_SGI")) {
	    arch_g = DB_SGI;
	} else if (!strcmp(argv[i], "DB_RS6000")) {
	    arch_g = DB_RS6000;
	} else if (!strcmp(argv[i], "DB_CRAY")) {
	    arch_g = DB_CRAY;
	} else {
	    fprintf(stderr, "%s: ignored argument `%s'\n", argv[0], argv[i]);
	}
    }
    
    
    /* turn of deprecate warnings */
    DBSetDeprecateWarnings(0);

    /*
     * Create a new file (clobbering any old file), write some variables to
     * the file, then read them and compare with what was written.
     */
    puts("=== Creating file ===");
    if (NULL==(dbfile=DBCreate(filename, DB_CLOBBER, arch_g,
			       "testing SAMI HDF5 silo driver", driver))) {
	puts("DBCreate() failed");
	nerrors++;
    }

    /* Write the first time, creating variables */
    nerrors += test_write_all(dbfile);
    nerrors += test_read_all(dbfile);
    
    nerrors += test_get_all(dbfile);
    nerrors += test_inqvar(dbfile);

    /* Write a second time, writing new values to existing variables */
    nerrors += test_write_all(dbfile);
    nerrors += test_read_all(dbfile);

    /* Rewrite with different memory data type and verify results */
    if (DB_PDB != driver)
    {
        nerrors += test_type_conv(dbfile);
    }

    /*
     * Do some illegal things to make sure they fail. Make sure we can still
     * read data.
     */
    if (DB_PDB != driver)
    {
        nerrors += test_write_bad(dbfile);
        nerrors += test_read_all(dbfile);
    }
    
    if (DBClose(dbfile)<0) {
	puts("DBClose() failed");
	nerrors++;
    }

    /* Open the file for read only and read all variables */
    puts("=== Opening for read-only ===");
    if (NULL==(dbfile=DBOpen(filename, DB_UNKNOWN, DB_READ))) {
	puts("DBOpen() failed for read-only access");
	nerrors++;
    }
    nerrors += test_read_all(dbfile);
    if (DBClose(dbfile)<0) {
	puts("DBClose() failed");
	nerrors++;
    }
    
    /* Open the file for read-write and test slicing */
    puts("=== Opening for read-write ===");
    if (NULL==(dbfile=DBOpen(filename, driver, DB_APPEND))) {
	puts("DBOpen() failed for read-write access");
	nerrors++;
    }
    
    nerrors += test_read_all(dbfile);
    nerrors += test_write_slice(dbfile);
    nerrors += test_read_all(dbfile);
    nerrors += test_read_slice(dbfile);
    nerrors += test_dirs(dbfile);
    nerrors += test_curve(dbfile);
    nerrors += test_quadmesh(dbfile);
    nerrors += test_ucdmesh(dbfile);

    if (DBClose(dbfile)<0) {
	puts("DBClose() failed");
	nerrors++;
    }

    if (nerrors) {
	printf("*** %d error%s detected ***\n", nerrors, 1==nerrors?"":"s");
    } else {
	puts("All sami tests passed.");
    }
    return nerrors?1:0;
}
コード例 #4
0
ファイル: spiro.c プロジェクト: blipvert/libspiro
int main(int argc, char **argv)
{
    return test_curve();
}