Changeset 2607 for trunk/psLib/test/astronomy/tst_psMetadata_02.c
- Timestamp:
- Dec 3, 2004, 1:19:07 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psMetadata_02.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psMetadata_02.c
r2392 r2607 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-1 1-22 20:54:50$16 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-12-03 23:19:07 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 #include <string.h> 26 26 27 static void printMetadataItem(psMetadataItem * item)27 static void printMetadataItem(psMetadataItem *metadataItem) 28 28 { 29 printf("Key Name: %8s ", item->name); 30 printf("Key Type: %2d ", item->type); 29 printf("Key Name: %8s ", metadataItem->name); 30 printf("Key pType: %2d ", metadataItem->pType); 31 printf("Key mdType: %2d ", metadataItem->type); 31 32 32 switch ( item->type) {33 case PS_META_ BOOL:34 printf("Key Value: %1 5d ", item->data.B);33 switch (metadataItem->type) { 34 case PS_META_LIST: 35 printf("Key Value: %17c", ' '); 35 36 break; 36 case PS_META_S32: 37 printf("Key Value: %15d ", item->data.S32); 38 break; 39 case PS_META_F32: 40 printf("Key Value: %15.3f ", item->data.F32); 41 break; 42 case PS_META_F64: 43 printf("Key Value: %15.3f ", item->data.F64); 37 case PS_META_PRIMITIVE: 38 switch(metadataItem->pType) { 39 case PS_TYPE_BOOL: 40 printf("Key Value: %15d ", metadataItem->data.B); 41 break; 42 case PS_TYPE_S32: 43 printf("Key Value: %15d ", metadataItem->data.S32); 44 break; 45 case PS_TYPE_F32: 46 printf("Key Value: %15.3f ", metadataItem->data.F32); 47 break; 48 case PS_TYPE_F64: 49 printf("Key Value: %15.3f ", metadataItem->data.F64); 50 break; 51 default: 52 printf("Bad type: %d ", metadataItem->pType); 53 } 44 54 break; 45 55 case PS_META_STR: 46 printf("Key Value: %15s ", (char*)item->data.V); 47 break; 48 case PS_META_IMG: 49 case PS_META_JPEG: 50 case PS_META_PNG: 51 case PS_META_ASTROM: 52 case PS_META_UNKNOWN: 53 printf("Value: unknown "); 56 printf("Key Value: %15s ", (char*)metadataItem->data.V); 54 57 break; 55 58 default: 56 printf("Bad type: %d ", item->type);59 printf("Bad type: %d ", metadataItem->type); 57 60 } 58 printf("Key Comment: %s\n", item->comment);61 printf("Key Comment: %s\n", metadataItem->comment); 59 62 } 60 63 … … 73 76 // Test A - Allocate metadata items 74 77 printPositiveTestHeader(stdout, "psMetadata", "Test A - Allocate metadata items"); 75 item1 = psMetadataItemAlloc("myItem1", PS_ META_BOOL, "I am a boolean", true);76 item2 = psMetadataItemAlloc("myItem2", PS_ META_S32, "I am a signed integer", 111);77 item3 = psMetadataItemAlloc("myItem3", PS_ META_F32, "I am a single precision floating point", 222.222);78 item4 = psMetadataItemAlloc("myItem4", PS_ META_F64, "I am a double precision floating point", 333.333);79 item5 = psMetadataItemAlloc("myItem5", PS_ META_STR, "I am a string", "HELLO WORLD");78 item1 = psMetadataItemAlloc("myItem1", PS_TYPE_BOOL, PS_META_PRIMITIVE, "I am a boolean", true); 79 item2 = psMetadataItemAlloc("myItem2", PS_TYPE_S32, PS_META_PRIMITIVE, "I am a signed integer", 111); 80 item3 = psMetadataItemAlloc("myItem3", PS_TYPE_F32, PS_META_PRIMITIVE, "I am a single precision floating point", 222.222); 81 item4 = psMetadataItemAlloc("myItem4", PS_TYPE_F64, PS_META_PRIMITIVE, "I am a double precision floating point", 333.333); 82 item5 = psMetadataItemAlloc("myItem5", PS_TYPE_PTR, PS_META_STR, "I am a string", "HELLO WORLD"); 80 83 printMetadataItem(item1); 81 84 printMetadataItem(item2); … … 90 93 "Null value for name not allowed", 0); 91 94 psLogMsg(__func__,PS_LOG_INFO,"Following should produce error for null name."); 92 badItem = psMetadataItemAlloc(NULL, PS_ META_STR, "I am a string", "HELLO WORLD");95 badItem = psMetadataItemAlloc(NULL, PS_TYPE_PTR, PS_META_STR, "I am a string", "HELLO WORLD"); 93 96 if (badItem != NULL) { 94 97 psError(PS_ERR_UNKNOWN, true,"psMetadataItemAlloc did not return null with null name item."); … … 101 104 printNegativeTestHeader(stdout,"psMetadata", "Test C - Attempt to create metadata item with invalid type", 102 105 "Invalid psMetadataType: 6", 0); 103 badItem = psMetadataItemAlloc("badItem", PS_ META_IMG, "I am bad", "Bad comment");106 badItem = psMetadataItemAlloc("badItem", PS_TYPE_PTR, PS_META_NTYPE, "I am bad", "Bad comment"); 104 107 printFooter(stdout, "psMetadata", "Test C - Attempt to create metadata item with invalid type", true); 105 108
Note:
See TracChangeset
for help on using the changeset viewer.
