Changeset 114 for trunk/test/src/RpUnits_test.cc
- Timestamp:
- Oct 20, 2005 8:47:25 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/src/RpUnits_test.cc
r104 r114 258 258 const RpUnits* eV = RpUnits::define("eV", NULL); 259 259 const RpUnits* joules = RpUnits::define("J", NULL); 260 260 261 261 RpUnits::define(eV, joules, electronVolt2joule, joule2electronVolt); 262 262 263 263 value = joules->convert(eV,1,&result); 264 264 std::cout << "1 joule = " << value << " electronVolts" << std::endl; 265 265 266 266 value = eV->convert(joules,1,&result); 267 267 std::cout << "1 electronVolt = " << value << " joules" << std::endl; 268 268 269 269 strValue = RpUnits::convert("10eV","J",1); 270 270 std::cout << "strValue convert(10eV,J,1) = " << strValue << std::endl; … … 272 272 strValue = RpUnits::convert("1eV","J",0); 273 273 std::cout << "strValue convert(1eV,J,0) = " << strValue << std::endl; 274 274 275 275 strValue = RpUnits::convert("10J","eV",1); 276 276 std::cout << "strValue convert(10J,eV,1) = " << strValue << std::endl; … … 278 278 strValue = RpUnits::convert("1J","eV",0); 279 279 std::cout << "strValue convert(1J,eV,0) = " << strValue << std::endl; 280 280 281 282 283 284 285 286 std::cout << "TESTING COPY CONSTRUCTOR" << std::endl; 287 288 RpUnits *origRpUnits = RpUnits::define("obj2", NULL); 289 RpUnits copyRpUnits = *origRpUnits; 290 291 std::cout << "origRpUnits = " << origRpUnits->getUnitsName() << std::endl; 292 std::cout << "copyRpUnits = " << copyRpUnits.getUnitsName() << std::endl; 293 std::cout << "modifying origRpUnits" << std::endl; 294 delete origRpUnits; 295 origRpUnits = RpUnits::define("obj3",NULL); 296 std::cout << "origRpUnits = " << origRpUnits->getUnitsName() << std::endl; 297 std::cout << "copyRpUnits = " << copyRpUnits.getUnitsName() << std::endl; 298 std::cout << "deleting origRpUnits" << std::endl; 299 delete origRpUnits; 300 std::cout << "copyRpUnits = " << copyRpUnits.getUnitsName() << std::endl; 301 302 std::cout << "TESTING COPY ASSIGNMENT OPERATOR" << std::endl; 303 304 RpUnits *testRpUnits = RpUnits::define("test2", NULL); 305 copyRpUnits = *testRpUnits; 306 307 std::cout << "testRpUnits = " << testRpUnits->getUnitsName() << std::endl; 308 std::cout << "copyRpUnits = " << copyRpUnits.getUnitsName() << std::endl; 309 std::cout << "modifying testRpUnits" << std::endl; 310 delete testRpUnits; 311 testRpUnits = RpUnits::define("test3",NULL); 312 std::cout << "testRpUnits = " << testRpUnits->getUnitsName() << std::endl; 313 std::cout << "copyRpUnits = " << copyRpUnits.getUnitsName() << std::endl; 314 std::cout << "deleting testRpUnits" << std::endl; 315 delete testRpUnits; 316 std::cout << "copyRpUnits = " << copyRpUnits.getUnitsName() << std::endl; 281 317 return 0; 282 318 }
Note: See TracChangeset
for help on using the changeset viewer.