IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9149 for trunk/ippdb/tests


Ignore:
Timestamp:
Oct 3, 2006, 12:09:49 PM (20 years ago)
Author:
jhoblitt
Message:

VERSION 0.0.40

Location:
trunk/ippdb/tests
Files:
14 edited

Legend:

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

    r9107 r9149  
    22#include <ippdb.h>
    33#include <stdlib.h>
     4#include <string.h>
    45
    56#define MAX_STRING_LENGTH 1024
     
    11851186
    11861187    {
     1188        detNormalizedExpRow *object;
     1189
     1190        object = detNormalizedExpRowAlloc(-32, -32, "a string", 64.64, 64.64, 64.64, "a string", "a string"    );
     1191
     1192        if (!object) {
     1193            exit(EXIT_FAILURE);
     1194        }
     1195
     1196        if (!object->det_id == -32) {
     1197            psFree(object);
     1198            exit(EXIT_FAILURE);
     1199        }
     1200        if (!object->iteration == -32) {
     1201            psFree(object);
     1202            exit(EXIT_FAILURE);
     1203        }
     1204        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
     1205            psFree(object);
     1206            exit(EXIT_FAILURE);
     1207        }
     1208        if (!object->bg == 64.64) {
     1209            psFree(object);
     1210            exit(EXIT_FAILURE);
     1211        }
     1212        if (!object->bg_stdev == 64.64) {
     1213            psFree(object);
     1214            exit(EXIT_FAILURE);
     1215        }
     1216        if (!object->bg_mean_stdev == 64.64) {
     1217            psFree(object);
     1218            exit(EXIT_FAILURE);
     1219        }
     1220        if (strncmp(object->b1_uri, "a string", MAX_STRING_LENGTH)) {
     1221            psFree(object);
     1222            exit(EXIT_FAILURE);
     1223        }
     1224        if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) {
     1225            psFree(object);
     1226            exit(EXIT_FAILURE);
     1227        }
     1228
     1229        psFree(object);
     1230    }
     1231
     1232    {
    11871233        detMasterFrameRow *object;
    11881234
  • trunk/ippdb/tests/createtable.c

    r9107 r9149  
    448448        }
    449449
     450        if(!detNormalizedExpCreateTable(dbh)) {
     451            exit(EXIT_FAILURE);
     452        }
     453
     454        psDBCleanup(dbh);
     455    }
     456
     457    {
     458        psDB            *dbh;
     459
     460        dbh = psDBInit("localhost", "test", NULL, "test");
     461        if (!dbh) {
     462            exit(EXIT_FAILURE);
     463        }
     464
    450465        if(!detMasterFrameCreateTable(dbh)) {
    451466            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/dbcleanup.c

    r9107 r9149  
    4040    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detNormalizedStatImfile");
    4141    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detNormalizedImfile");
     42    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detNormalizedExp");
    4243    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detMasterFrame");
    4344    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detMasterImfile");
  • trunk/ippdb/tests/dbsetup.c

    r9107 r9149  
    100100    detNormalizedImfileCreateTable(dbh);
    101101
     102    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detNormalizedExp");
     103    detNormalizedExpCreateTable(dbh);
     104
    102105    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detMasterFrame");
    103106    detMasterFrameCreateTable(dbh);
  • trunk/ippdb/tests/droptable.c

    r9107 r9149  
    448448        }
    449449
     450        if (!detNormalizedExpDropTable(dbh)) {
     451            exit(EXIT_FAILURE);
     452        }
     453
     454        psDBCleanup(dbh);
     455    }
     456
     457    {
     458        psDB            *dbh;
     459
     460        dbh = psDBInit("localhost", "test", NULL, "test");
     461        if (!dbh) {
     462            exit(EXIT_FAILURE);
     463        }
     464
    450465        if (!detMasterFrameDropTable(dbh)) {
    451466            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insert.c

    r9107 r9149  
    448448        }
    449449
     450        if (!detNormalizedExpInsert(dbh, -32, -32, "a string", 64.64, 64.64, 64.64, "a string", "a string")) {
     451            exit(EXIT_FAILURE);
     452        }
     453
     454        psDBCleanup(dbh);
     455    }
     456
     457    {
     458        psDB            *dbh;
     459
     460        dbh = psDBInit("localhost", "test", NULL, "test");
     461        if (!dbh) {
     462            exit(EXIT_FAILURE);
     463        }
     464
    450465        if (!detMasterFrameInsert(dbh, -32, -32, "a string")) {
    451466            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insertfits.c

    r9107 r9149  
    778778        }
    779779
     780        if (!detNormalizedExpInsertFits(dbh, fits)) {
     781            exit(EXIT_FAILURE);
     782        }
     783
     784        if (!psFitsClose(fits)) {
     785            exit(EXIT_FAILURE);
     786        }
     787
     788        psDBCleanup(dbh);
     789    }
     790
     791    {
     792        psDB            *dbh;
     793        psFits          *fits;
     794
     795        dbh = psDBInit("localhost", "test", NULL, "test");
     796        if (!dbh) {
     797            exit(EXIT_FAILURE);
     798        }
     799
     800        // open a temp
     801        fits = psFitsOpen(TMP_FILENAME, "r");
     802        if (!fits) {
     803            exit(EXIT_FAILURE);
     804        }
     805
    780806        if (!detMasterFrameInsertFits(dbh, fits)) {
    781807            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insertobject.c

    r9107 r9149  
    645645    {
    646646        psDB            *dbh;
     647        detNormalizedExpRow *object;
     648
     649        dbh = psDBInit("localhost", "test", NULL, "test");
     650        if (!dbh) {
     651            exit(EXIT_FAILURE);
     652        }
     653
     654        object = detNormalizedExpRowAlloc(-32, -32, "a string", 64.64, 64.64, 64.64, "a string", "a string");
     655        if (!object) {
     656            exit(EXIT_FAILURE);
     657        }
     658
     659        if (!detNormalizedExpInsertObject(dbh, object)) {
     660            exit(EXIT_FAILURE);
     661        }
     662
     663        psFree(object);
     664        psDBCleanup(dbh);
     665    }
     666
     667    {
     668        psDB            *dbh;
    647669        detMasterFrameRow *object;
    648670
  • trunk/ippdb/tests/metadatafromobject.c

    r9107 r9149  
    14191419    {
    14201420        psMetadata      *md;
     1421        detNormalizedExpRow *object;
     1422        bool            status;
     1423
     1424        object = detNormalizedExpRowAlloc(-32, -32, "a string", 64.64, 64.64, 64.64, "a string", "a string");
     1425        if (!object) {
     1426            exit(EXIT_FAILURE);
     1427        }
     1428
     1429        md = detNormalizedExpMetadataFromObject(object);
     1430        if (!md) {
     1431            exit(EXIT_FAILURE);
     1432        }
     1433
     1434        psFree(object);
     1435
     1436        if (!psMetadataLookupS32(&status, md, "det_id") == -32) {
     1437            psFree(md);
     1438            exit(EXIT_FAILURE);
     1439        }
     1440        if (!psMetadataLookupS32(&status, md, "iteration") == -32) {
     1441            psFree(md);
     1442            exit(EXIT_FAILURE);
     1443        }
     1444        if (strncmp(psMetadataLookupPtr(&status, md, "recipe"), "a string", MAX_STRING_LENGTH)) {
     1445            psFree(md);
     1446            exit(EXIT_FAILURE);
     1447        }
     1448        if (!psMetadataLookupF64(&status, md, "bg") == 64.64) {
     1449            psFree(md);
     1450            exit(EXIT_FAILURE);
     1451        }
     1452        if (!psMetadataLookupF64(&status, md, "bg_stdev") == 64.64) {
     1453            psFree(md);
     1454            exit(EXIT_FAILURE);
     1455        }
     1456        if (!psMetadataLookupF64(&status, md, "bg_mean_stdev") == 64.64) {
     1457            psFree(md);
     1458            exit(EXIT_FAILURE);
     1459        }
     1460        if (strncmp(psMetadataLookupPtr(&status, md, "b1_uri"), "a string", MAX_STRING_LENGTH)) {
     1461            psFree(md);
     1462            exit(EXIT_FAILURE);
     1463        }
     1464        if (strncmp(psMetadataLookupPtr(&status, md, "b2_uri"), "a string", MAX_STRING_LENGTH)) {
     1465            psFree(md);
     1466            exit(EXIT_FAILURE);
     1467        }
     1468
     1469        psFree(md);
     1470    }
     1471
     1472    {
     1473        psMetadata      *md;
    14211474        detMasterFrameRow *object;
    14221475        bool            status;
  • trunk/ippdb/tests/objectfrommetadata.c

    r9107 r9149  
    21322132    {
    21332133        psMetadata      *md;
     2134        detNormalizedExpRow *object;
     2135
     2136        md = psMetadataAlloc();
     2137        if (!psMetadataAddS32(md, PS_LIST_TAIL, "det_id", 0, NULL, -32)) {
     2138            psFree(md);
     2139            exit(EXIT_FAILURE);
     2140        }
     2141        if (!psMetadataAddS32(md, PS_LIST_TAIL, "iteration", 0, NULL, -32)) {
     2142            psFree(md);
     2143            exit(EXIT_FAILURE);
     2144        }
     2145        if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, "a string")) {
     2146            psFree(md);
     2147            exit(EXIT_FAILURE);
     2148        }
     2149        if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg", 0, NULL, 64.64)) {
     2150            psFree(md);
     2151            exit(EXIT_FAILURE);
     2152        }
     2153        if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_stdev", 0, NULL, 64.64)) {
     2154            psFree(md);
     2155            exit(EXIT_FAILURE);
     2156        }
     2157        if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, 64.64)) {
     2158            psFree(md);
     2159            exit(EXIT_FAILURE);
     2160        }
     2161        if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "a string")) {
     2162            psFree(md);
     2163            exit(EXIT_FAILURE);
     2164        }
     2165        if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "a string")) {
     2166            psFree(md);
     2167            exit(EXIT_FAILURE);
     2168        }
     2169
     2170        object = detNormalizedExpObjectFromMetadata(md);
     2171        if (!object) {
     2172            psFree(md);
     2173            exit(EXIT_FAILURE);
     2174        }
     2175
     2176        psFree(md);
     2177
     2178        if (!object->det_id == -32) {
     2179            psFree(object);
     2180            exit(EXIT_FAILURE);
     2181        }
     2182        if (!object->iteration == -32) {
     2183            psFree(object);
     2184            exit(EXIT_FAILURE);
     2185        }
     2186        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
     2187            psFree(object);
     2188            exit(EXIT_FAILURE);
     2189        }
     2190        if (!object->bg == 64.64) {
     2191            psFree(object);
     2192            exit(EXIT_FAILURE);
     2193        }
     2194        if (!object->bg_stdev == 64.64) {
     2195            psFree(object);
     2196            exit(EXIT_FAILURE);
     2197        }
     2198        if (!object->bg_mean_stdev == 64.64) {
     2199            psFree(object);
     2200            exit(EXIT_FAILURE);
     2201        }
     2202        if (strncmp(object->b1_uri, "a string", MAX_STRING_LENGTH)) {
     2203            psFree(object);
     2204            exit(EXIT_FAILURE);
     2205        }
     2206        if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) {
     2207            psFree(object);
     2208            exit(EXIT_FAILURE);
     2209        }
     2210
     2211        psFree(object);
     2212    }
     2213
     2214    {
     2215        psMetadata      *md;
    21342216        detMasterFrameRow *object;
    21352217
  • trunk/ippdb/tests/pop.c

    r9107 r9149  
    644644        psS32           det_id;
    645645        psS32           iteration;
     646        char            recipe[256];
     647        psF64           bg;
     648        psF64           bg_stdev;
     649        psF64           bg_mean_stdev;
     650        char            b1_uri[256];
     651        char            b2_uri[256];
     652
     653        dbh = psDBInit("localhost", "test", NULL, "test");
     654        if (!dbh) {
     655            exit(EXIT_FAILURE);
     656        }
     657
     658        if (!detNormalizedExpPop(dbh, &det_id, &iteration, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev, (char **)&b1_uri, (char **)&b2_uri)) {
     659            exit(EXIT_FAILURE);
     660        }
     661
     662        psDBCleanup(dbh);
     663    }
     664
     665    {
     666        psDB            *dbh;
     667        psS32           det_id;
     668        psS32           iteration;
    646669        char            comment[256];
    647670
  • trunk/ippdb/tests/popfits.c

    r9107 r9149  
    778778        }
    779779
     780        if (!detNormalizedExpPopFits(dbh, fits, 1)) {
     781            exit(EXIT_FAILURE);
     782        }
     783
     784        if (!psFitsClose(fits)) {
     785            exit(EXIT_FAILURE);
     786        }
     787
     788        psDBCleanup(dbh);
     789    }
     790
     791    {
     792        psDB            *dbh;
     793        psFits          *fits;
     794
     795        dbh = psDBInit("localhost", "test", NULL, "test");
     796        if (!dbh) {
     797            exit(EXIT_FAILURE);
     798        }
     799
     800        // allocate a temp
     801        fits = psFitsOpen(TMP_FILENAME, "w");
     802        if (!fits) {
     803            exit(EXIT_FAILURE);
     804        }
     805
    780806        if (!detMasterFramePopFits(dbh, fits, 1)) {
    781807            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/popobject.c

    r9107 r9149  
    529529    {
    530530        psDB            *dbh;
     531        detNormalizedExpRow *object;
     532
     533        dbh = psDBInit("localhost", "test", NULL, "test");
     534        if (!dbh) {
     535            exit(EXIT_FAILURE);
     536        }
     537
     538        object = detNormalizedExpPopObject(dbh);
     539        if (!object) {
     540            exit(EXIT_FAILURE);
     541        }
     542
     543        psFree(object);
     544        psDBCleanup(dbh);
     545    }
     546
     547    {
     548        psDB            *dbh;
    531549        detMasterFrameRow *object;
    532550
  • trunk/ippdb/tests/selectrowsfits.c

    r9107 r9149  
    659659        }
    660660
     661        if (!detNormalizedExpSelectRowsFits(dbh, fits, NULL, 1)) {
     662            exit(EXIT_FAILURE);
     663        }
     664
     665        psFree(fits);
     666        psDBCleanup(dbh);
     667    }
     668
     669    {
     670        psDB            *dbh;
     671        psFits          *fits;
     672
     673        dbh = psDBInit("localhost", "test", NULL, "test");
     674        if (!dbh) {
     675            exit(EXIT_FAILURE);
     676        }
     677
     678        fits = psFitsOpen(TMP_FILENAME, "w");
     679        if (!fits) {
     680            exit(EXIT_FAILURE);
     681        }
     682
    661683        if (!detMasterFrameSelectRowsFits(dbh, fits, NULL, 1)) {
    662684            exit(EXIT_FAILURE);
Note: See TracChangeset for help on using the changeset viewer.