IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9788 for trunk/ippdb/tests


Ignore:
Timestamp:
Oct 30, 2006, 11:55:36 AM (20 years ago)
Author:
jhoblitt
Message:

VERSION 0.0.53

Location:
trunk/ippdb/tests
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippdb/tests/alloc.c

    r9783 r9788  
    650650        p3PendingExpRow *object;
    651651
    652         object = p3PendingExpRowAlloc("a string", -32, -32    );
     652        object = p3PendingExpRowAlloc("a string", -32, -32, "a string"    );
    653653
    654654        if (!object) {
     
    668668            exit(EXIT_FAILURE);
    669669        }
     670        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
     671            psFree(object);
     672            exit(EXIT_FAILURE);
     673        }
    670674
    671675        psFree(object);
     
    675679        p3ProcessedExpRow *object;
    676680
    677         object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32    );
     681        object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string"    );
    678682
    679683        if (!object) {
     
    738742        }
    739743        if (!object->p3_version == -32) {
     744            psFree(object);
     745            exit(EXIT_FAILURE);
     746        }
     747        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
     748            psFree(object);
     749            exit(EXIT_FAILURE);
     750        }
     751
     752        psFree(object);
     753    }
     754
     755    {
     756        p3MaskRow       *object;
     757
     758        object = p3MaskRowAlloc("a string"    );
     759
     760        if (!object) {
     761            exit(EXIT_FAILURE);
     762        }
     763
     764        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
    740765            psFree(object);
    741766            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/createtable.c

    r9783 r9788  
    253253        }
    254254
     255        if(!p3MaskCreateTable(dbh)) {
     256            exit(EXIT_FAILURE);
     257        }
     258
     259        psDBCleanup(dbh);
     260    }
     261
     262    {
     263        psDB            *dbh;
     264
     265        dbh = psDBInit("localhost", "test", NULL, "test");
     266        if (!dbh) {
     267            exit(EXIT_FAILURE);
     268        }
     269
    255270        if(!detRunCreateTable(dbh)) {
    256271            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/dbcleanup.c

    r9783 r9788  
    2727    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p3PendingExp");
    2828    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p3ProcessedExp");
     29    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p3Mask");
    2930    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detRun");
    3031    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detInputExp");
  • trunk/ippdb/tests/dbsetup.c

    r9783 r9788  
    6161    p3ProcessedExpCreateTable(dbh);
    6262
     63    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p3Mask");
     64    p3MaskCreateTable(dbh);
     65
    6366    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detRun");
    6467    detRunCreateTable(dbh);
  • trunk/ippdb/tests/droptable.c

    r9783 r9788  
    253253        }
    254254
     255        if (!p3MaskDropTable(dbh)) {
     256            exit(EXIT_FAILURE);
     257        }
     258
     259        psDBCleanup(dbh);
     260    }
     261
     262    {
     263        psDB            *dbh;
     264
     265        dbh = psDBInit("localhost", "test", NULL, "test");
     266        if (!dbh) {
     267            exit(EXIT_FAILURE);
     268        }
     269
    255270        if (!detRunDropTable(dbh)) {
    256271            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insert.c

    r9783 r9788  
    223223        }
    224224
    225         if (!p3PendingExpInsert(dbh, "a string", -32, -32)) {
    226             exit(EXIT_FAILURE);
    227         }
    228 
    229         psDBCleanup(dbh);
    230     }
    231 
    232     {
    233         psDB            *dbh;
    234 
    235         dbh = psDBInit("localhost", "test", NULL, "test");
    236         if (!dbh) {
    237             exit(EXIT_FAILURE);
    238         }
    239 
    240         if (!p3ProcessedExpInsert(dbh, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32)) {
     225        if (!p3PendingExpInsert(dbh, "a string", -32, -32, "a string")) {
     226            exit(EXIT_FAILURE);
     227        }
     228
     229        psDBCleanup(dbh);
     230    }
     231
     232    {
     233        psDB            *dbh;
     234
     235        dbh = psDBInit("localhost", "test", NULL, "test");
     236        if (!dbh) {
     237            exit(EXIT_FAILURE);
     238        }
     239
     240        if (!p3ProcessedExpInsert(dbh, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string")) {
     241            exit(EXIT_FAILURE);
     242        }
     243
     244        psDBCleanup(dbh);
     245    }
     246
     247    {
     248        psDB            *dbh;
     249
     250        dbh = psDBInit("localhost", "test", NULL, "test");
     251        if (!dbh) {
     252            exit(EXIT_FAILURE);
     253        }
     254
     255        if (!p3MaskInsert(dbh, "a string")) {
    241256            exit(EXIT_FAILURE);
    242257        }
  • trunk/ippdb/tests/insertfits.c

    r9783 r9788  
    440440        }
    441441
     442        if (!p3MaskInsertFits(dbh, fits)) {
     443            exit(EXIT_FAILURE);
     444        }
     445
     446        if (!psFitsClose(fits)) {
     447            exit(EXIT_FAILURE);
     448        }
     449
     450        psDBCleanup(dbh);
     451    }
     452
     453    {
     454        psDB            *dbh;
     455        psFits          *fits;
     456
     457        dbh = psDBInit("localhost", "test", NULL, "test");
     458        if (!dbh) {
     459            exit(EXIT_FAILURE);
     460        }
     461
     462        // open a temp
     463        fits = psFitsOpen(TMP_FILENAME, "r");
     464        if (!fits) {
     465            exit(EXIT_FAILURE);
     466        }
     467
    442468        if (!detRunInsertFits(dbh, fits)) {
    443469            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insertobject.c

    r9783 r9788  
    322322        }
    323323
    324         object = p3PendingExpRowAlloc("a string", -32, -32);
     324        object = p3PendingExpRowAlloc("a string", -32, -32, "a string");
    325325        if (!object) {
    326326            exit(EXIT_FAILURE);
     
    344344        }
    345345
    346         object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32);
     346        object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string");
    347347        if (!object) {
    348348            exit(EXIT_FAILURE);
     
    350350
    351351        if (!p3ProcessedExpInsertObject(dbh, object)) {
     352            exit(EXIT_FAILURE);
     353        }
     354
     355        psFree(object);
     356        psDBCleanup(dbh);
     357    }
     358
     359    {
     360        psDB            *dbh;
     361        p3MaskRow       *object;
     362
     363        dbh = psDBInit("localhost", "test", NULL, "test");
     364        if (!dbh) {
     365            exit(EXIT_FAILURE);
     366        }
     367
     368        object = p3MaskRowAlloc("a string");
     369        if (!object) {
     370            exit(EXIT_FAILURE);
     371        }
     372
     373        if (!p3MaskInsertObject(dbh, object)) {
    352374            exit(EXIT_FAILURE);
    353375        }
  • trunk/ippdb/tests/metadatafromobject.c

    r9783 r9788  
    764764        bool            status;
    765765
    766         object = p3PendingExpRowAlloc("a string", -32, -32);
     766        object = p3PendingExpRowAlloc("a string", -32, -32, "a string");
    767767        if (!object) {
    768768            exit(EXIT_FAILURE);
     
    788788            exit(EXIT_FAILURE);
    789789        }
     790        if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) {
     791            psFree(md);
     792            exit(EXIT_FAILURE);
     793        }
    790794
    791795        psFree(md);
     
    797801        bool            status;
    798802
    799         object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32);
     803        object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string");
    800804        if (!object) {
    801805            exit(EXIT_FAILURE);
     
    866870        }
    867871        if (!psMetadataLookupS32(&status, md, "p3_version") == -32) {
     872            psFree(md);
     873            exit(EXIT_FAILURE);
     874        }
     875        if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) {
     876            psFree(md);
     877            exit(EXIT_FAILURE);
     878        }
     879
     880        psFree(md);
     881    }
     882
     883    {
     884        psMetadata      *md;
     885        p3MaskRow       *object;
     886        bool            status;
     887
     888        object = p3MaskRowAlloc("a string");
     889        if (!object) {
     890            exit(EXIT_FAILURE);
     891        }
     892
     893        md = p3MaskMetadataFromObject(object);
     894        if (!md) {
     895            exit(EXIT_FAILURE);
     896        }
     897
     898        psFree(object);
     899
     900        if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) {
    868901            psFree(md);
    869902            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/objectfrommetadata.c

    r9783 r9788  
    11911191            exit(EXIT_FAILURE);
    11921192        }
     1193        if (!psMetadataAddStr(md, PS_LIST_TAIL, "label", 0, NULL, "a string")) {
     1194            psFree(md);
     1195            exit(EXIT_FAILURE);
     1196        }
    11931197
    11941198        object = p3PendingExpObjectFromMetadata(md);
     
    12121216            exit(EXIT_FAILURE);
    12131217        }
     1218        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
     1219            psFree(object);
     1220            exit(EXIT_FAILURE);
     1221        }
    12141222
    12151223        psFree(object);
     
    12811289            exit(EXIT_FAILURE);
    12821290        }
     1291        if (!psMetadataAddStr(md, PS_LIST_TAIL, "label", 0, NULL, "a string")) {
     1292            psFree(md);
     1293            exit(EXIT_FAILURE);
     1294        }
    12831295
    12841296        object = p3ProcessedExpObjectFromMetadata(md);
     
    13471359        }
    13481360        if (!object->p3_version == -32) {
     1361            psFree(object);
     1362            exit(EXIT_FAILURE);
     1363        }
     1364        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
     1365            psFree(object);
     1366            exit(EXIT_FAILURE);
     1367        }
     1368
     1369        psFree(object);
     1370    }
     1371
     1372    {
     1373        psMetadata      *md;
     1374        p3MaskRow       *object;
     1375
     1376        md = psMetadataAlloc();
     1377        if (!psMetadataAddStr(md, PS_LIST_TAIL, "label", 0, NULL, "a string")) {
     1378            psFree(md);
     1379            exit(EXIT_FAILURE);
     1380        }
     1381
     1382        object = p3MaskObjectFromMetadata(md);
     1383        if (!object) {
     1384            psFree(md);
     1385            exit(EXIT_FAILURE);
     1386        }
     1387
     1388        psFree(md);
     1389
     1390        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
    13491391            psFree(object);
    13501392            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/selectrowsfits.c

    r9783 r9788  
    373373        }
    374374
     375        if (!p3MaskSelectRowsFits(dbh, fits, NULL, 1)) {
     376            exit(EXIT_FAILURE);
     377        }
     378
     379        psFree(fits);
     380        psDBCleanup(dbh);
     381    }
     382
     383    {
     384        psDB            *dbh;
     385        psFits          *fits;
     386
     387        dbh = psDBInit("localhost", "test", NULL, "test");
     388        if (!dbh) {
     389            exit(EXIT_FAILURE);
     390        }
     391
     392        fits = psFitsOpen(TMP_FILENAME, "w");
     393        if (!fits) {
     394            exit(EXIT_FAILURE);
     395        }
     396
    375397        if (!detRunSelectRowsFits(dbh, fits, NULL, 1)) {
    376398            exit(EXIT_FAILURE);
Note: See TracChangeset for help on using the changeset viewer.