Changeset 93 for trunk/test/src
- Timestamp:
- Oct 6, 2005 3:33:41 PM (17 years ago)
- Location:
- trunk/test/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/src/RpLibraryC_test.c
r83 r93 28 28 printf("TESTING ELEMENT: path = %s\n", path); 29 29 30 searchEle = element(lib,path);31 type = elementAsType(lib,path);32 comp = elementAsComp(lib,path);33 id = elementAsId(lib,path);30 searchEle = rpElement(lib,path); 31 type = rpElementAsType(lib,path); 32 comp = rpElementAsComp(lib,path); 33 id = rpElementAsId(lib,path); 34 34 35 35 if (!searchEle) { … … 42 42 printf("searchEle type = :%s:\n", type); 43 43 44 comp = nodeComp(searchEle);45 id = nodeId(searchEle);46 type = nodeType(searchEle);47 44 comp = rpNodeComp(searchEle); 45 id = rpNodeId(searchEle); 46 type = rpNodeType(searchEle); 47 48 48 printf("searchEle comp = :%s:\n", comp); 49 49 printf("searchEle id = :%s:\n", id); … … 63 63 printf("TESTING GET String: path = %s\n", path); 64 64 65 searchVal = getString(lib,path);65 searchVal = rpGetString(lib,path); 66 66 67 67 if (!searchVal || *searchVal == '\0') { … … 84 84 printf("TESTING GET Double: path = %s\n", path); 85 85 86 searchVal = getDouble(lib,path);86 searchVal = rpGetDouble(lib,path); 87 87 88 88 printf("searchVal = :%f:\n", searchVal); … … 102 102 printf("TESTING CHILDREN: path = %s\n", path); 103 103 104 while ( (childEle = children(lib,path,childEle)) ) {105 comp = nodeComp(childEle);106 id = nodeId(childEle);107 type = nodeType(childEle);104 while ( (childEle = rpChildren(lib,path,childEle)) ) { 105 comp = rpNodeComp(childEle); 106 id = rpNodeId(childEle); 107 type = rpNodeType(childEle); 108 108 109 109 printf("childEle comp = :%s:\n",comp); … … 128 128 printf("TESTING CHILDREN: path = %s\n", path); 129 129 130 while ( (childEle = childrenByType(lib,path,childEle,searchType)) ) {131 comp = nodeComp(childEle);132 id = nodeId(childEle);133 type = nodeType(childEle);130 while ( (childEle = rpChildrenByType(lib,path,childEle,searchType)) ) { 131 comp = rpNodeComp(childEle); 132 id = rpNodeId(childEle); 133 type = rpNodeType(childEle); 134 134 135 135 printf("childEle comp = :%s:\n",comp); … … 151 151 printf("TESTING PUT String: path = %s\n", path); 152 152 153 putString(lib,path,value,append);154 searchVal = getString(lib, path);153 rpPutString(lib,path,value,append); 154 searchVal = rpGetString(lib, path); 155 155 156 156 if (!searchVal || *searchVal == '\0') { … … 173 173 printf("TESTING PUT String: path = %s\n", path); 174 174 175 putDouble(lib,path,value,append);176 searchVal = getDouble(lib, path);175 rpPutDouble(lib,path,value,append); 176 searchVal = rpGetDouble(lib, path); 177 177 printf("searchVal = :%f:\n", searchVal); 178 178 retVal = 0; … … 186 186 RpLibrary* lib = NULL; 187 187 188 if (argc < 3)188 if (argc < 2) 189 189 { 190 printf("usage: RpLibrary_test infile.xml outfile.xml\n");190 printf("usage: %s driver.xml\n", argv[0]); 191 191 return -1; 192 192 } 193 193 194 lib = library(argv[1]);194 lib = rpLibrary(argv[1]); 195 195 196 196 test_element(lib,"input.number(min)"); … … 217 217 test_childrenByType(lib,"input.number(test)","preset"); 218 218 219 printf("XML = \n%s\n", xml(lib));219 printf("XML = \n%s\n",rpXml(lib)); 220 220 221 freeLibrary(lib);221 rpFreeLibrary(lib); 222 222 223 223 return 0; -
trunk/test/src/RpLibraryF_test.f
r84 r93 5 5 c 6 6 c ====================================================================== 7 c AUTHOR: Derrick Kearney, Purdue University7 c AUTHOR: Derrick S. Kearney, Purdue University 8 8 c Copyright (c) 2005 9 9 c Purdue Research Foundation, West Lafayette, IN -
trunk/test/src/RpUnitsC_test.c
r76 r93 48 48 } 49 49 50 int main() 50 int main() 51 51 { 52 52 53 RpUnits* meters = defineUnit("m",NULL);53 RpUnits* meters = rpDefineUnit("m",NULL); 54 54 55 55 RpUnits* centimeters = NULL; … … 57 57 RpUnits* cm_basis = NULL; 58 58 59 RpUnits* angstrom = defineUnit("A",NULL);60 RpUnits* fahrenheit = defineUnit("F",NULL);61 RpUnits* celcius = defineUnit("C",NULL);62 RpUnits* kelvin = defineUnit("K",NULL);59 RpUnits* angstrom = rpDefineUnit("A",NULL); 60 RpUnits* fahrenheit = rpDefineUnit("F",NULL); 61 RpUnits* celcius = rpDefineUnit("C",NULL); 62 RpUnits* kelvin = rpDefineUnit("K",NULL); 63 63 64 defineConv(angstrom, meters, angstrom2meter, meter2angstrom);65 defineConv(fahrenheit, celcius, fahrenheit2centigrade, centigrade2fahrenheit);66 defineConv(celcius, kelvin, centigrade2kelvin, kelvin2centigrade);67 68 64 rpDefineConv(angstrom, meters, angstrom2meter, meter2angstrom); 65 rpDefineConv(fahrenheit, celcius, fahrenheit2centigrade, centigrade2fahrenheit); 66 rpDefineConv(celcius, kelvin, centigrade2kelvin, kelvin2centigrade); 67 68 69 69 double cm_exp = 0; 70 70 double nm_conv = 0; 71 71 double value = 0; 72 72 73 73 int result = 0; 74 74 int showUnits = 0; … … 76 76 const char* nm_conv_str = NULL; 77 77 const char* retStr = NULL; 78 79 makeMetric(meters);80 centimeters = find("cm");81 78 79 rpMakeMetric(meters); 80 centimeters = rpFind("cm"); 81 82 82 if (meters) { 83 printf("meters sign is :%s:\n", getUnitsName(meters));83 printf("meters sign is :%s:\n",rpGetUnitsName(meters)); 84 84 } 85 85 86 86 if (centimeters) { 87 cm_exp = getExponent(centimeters);88 cm_basis = getBasis(centimeters);87 cm_exp = rpGetExponent(centimeters); 88 cm_basis = rpGetBasis(centimeters); 89 89 90 printf("centimeters sign is :%s:\n", getUnits(centimeters));90 printf("centimeters sign is :%s:\n",rpGetUnits(centimeters)); 91 91 printf("cm_exp is :%f:\n",cm_exp); 92 92 93 93 if (cm_basis) { 94 printf("cm_basis sign is :%s:\n", getUnitsName(cm_basis));94 printf("cm_basis sign is :%s:\n",rpGetUnitsName(cm_basis)); 95 95 } 96 96 else { … … 100 100 } 101 101 102 nanometers = find("nm");102 nanometers = rpFind("nm"); 103 103 104 104 if (nanometers) { 105 105 106 nm_conv = convert_obj_double_result(nanometers,meters,1.0e9,&result);106 nm_conv = rpConvert_ObjDbl(nanometers,meters,1.0e9,&result); 107 107 printf("1.0e9 nm = %f m\tresult = %d\n",nm_conv,result); 108 108 109 nm_conv = convert_obj_double(nanometers,meters,1.0e9);109 nm_conv = rpConvert_ObjDbl(nanometers,meters,1.0e9, NULL); 110 110 printf("1.0e9 nm = %f m\n",nm_conv); 111 111 112 112 showUnits = 1; 113 nm_conv_str = convert_obj_str(nanometers,meters,1.588e9,showUnits);113 nm_conv_str = rpConvert_ObjStr(nanometers,meters,1.588e9,showUnits,NULL); 114 114 printf("1.588e9 nm = %s\n",nm_conv_str); 115 115 116 116 showUnits = 0; 117 nm_conv_str = convert_obj_str(nanometers,meters,1.588e9,showUnits);117 nm_conv_str = rpConvert_ObjStr(nanometers,meters,1.588e9,showUnits,NULL); 118 118 printf("1.588e9 nm = %s\n",nm_conv_str); 119 119 } … … 123 123 124 124 if (meters && angstrom && centimeters) { 125 value = convert_obj_double_result(angstrom,meters,1.0,&result);125 value = rpConvert_ObjDbl(angstrom,meters,1.0,&result); 126 126 printf("1 angstrom = %e meters\n",value); 127 127 128 value = convert_obj_double_result(centimeters,angstrom,1e-8,&result);128 value = rpConvert_ObjDbl(centimeters,angstrom,1e-8,&result); 129 129 printf("1.0e-8 centimeter = %f angstroms\n",value); 130 130 } … … 135 135 136 136 if (fahrenheit && celcius) { 137 value = convert_obj_double_result(fahrenheit,celcius,72,&result);137 value = rpConvert_ObjDbl(fahrenheit,celcius,72,&result); 138 138 printf("72 degrees fahrenheit = %f degrees celcius\n",value); 139 140 value = convert_obj_double_result(celcius,fahrenheit,value,&result);139 140 value = rpConvert_ObjDbl(celcius,fahrenheit,value,&result); 141 141 printf("22.222 degrees celcius = %f degrees fahrenheit\n",value); 142 142 } … … 144 144 printf("fahrenheit or celcius is NULL\n"); 145 145 } 146 146 147 147 if (celcius && kelvin) { 148 value = convert_obj_double_result(celcius,kelvin,20,&result);148 value = rpConvert_ObjDbl(celcius,kelvin,20,&result); 149 149 printf("20 degrees celcius = %f kelvin\n",value); 150 150 151 value = convert_obj_double_result(kelvin,celcius,300,&result);151 value = rpConvert_ObjDbl(kelvin,celcius,300,&result); 152 152 printf("300 kelvin = %f degrees celcius\n", value); 153 153 } … … 157 157 158 158 printf("====== adding all preset units ======\n"); 159 add_presets("all");159 rpAddPresets("all"); 160 160 161 161 printf("====== TESTING STATIC CONVERT FXNS ======\n"); 162 162 163 retStr = convert("72F","C",1,&result);163 retStr = rpConvert("72F","C",1,&result); 164 164 printf("72F = %s\tresult = %d\n", retStr,result); 165 165 166 retStr = convert("300K","F",1,&result);166 retStr = rpConvert("300K","F",1,&result); 167 167 printf("300K = %s\tresult = %d\n", retStr,result); 168 168 169 retStr = convert("1eV","J",0,&result);169 retStr = rpConvert("1eV","J",0,&result); 170 170 printf("1eV = %s (no units)\tresult = %d\n", retStr,result); 171 171 172 retStr = convert_str("300K","R",1,&result);172 retStr = rpConvertStr("300K","R",1,&result); 173 173 printf("300K = %s\tresult = %d\n", retStr,result); 174 174 175 retStr = convert_str("5m","ft",1,&result);175 retStr = rpConvertStr("5m","ft",1,&result); 176 176 printf("5m = %s\tresult = %d\n", retStr,result); 177 177 178 value = convert_dbl("5000mV","V",&result);178 value = rpConvertDbl("5000mV","V",&result); 179 179 printf("5V = %f (double value)\n", value); 180 180 181 181 182 182 return 0; 183 183 }
Note: See TracChangeset
for help on using the changeset viewer.