Changeset 68 for trunk/test


Ignore:
Timestamp:
Sep 26, 2005 6:55:39 PM (19 years ago)
Author:
dkearney
Message:

fixed the python rpunits setup script so now it really finds PyRpUnits?.cc

added more conversions to RpUnitsStd?.[h,cc]

added static convert function to RpUnits.[h,cc] so now users can ask for a
conversion as without having to make an RpUnits Object. instead, the
user specifies the value to be converted (value with attached units) as well
as the units we should convert to and if they want units in the returned
string. if the units exist, the conversion is done, if not, the original
string should be returned.

also added the ability to load preset units into the dictionary.
use the static function RpUnits::addPresets(...) in c++ this is done
automatically in python (although, maybe it shouldn't be).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/src/RpUnits_test.cc

    r40 r68  
    1717{
    1818    double value = 0.0;
     19    std::string strValue;
    1920    // int failTest = 0;
    2021    int result = 0;
     
    225226    printf("2 m = :%f: meters\n", value);
    226227
     228    printf ("=============== TEST 5 ===============\n");
     229
     230    strValue = RpUnits::convert("72F","C",1);
     231    std::cout << "result = " << result << std::endl;
     232    std::cout << "strValue convert(72F,C,1) = " << strValue << std::endl;
     233
     234    strValue = RpUnits::convert("72F","C",0);
     235    std::cout << "result = " << result << std::endl;
     236    std::cout << "strValue convert(72F,C,0) = " << strValue << std::endl;
     237
     238    strValue = RpUnits::convert("20C","K",1);
     239    std::cout << "result = " << result << std::endl;
     240    std::cout << "strValue convert(20C,K,1) = " << strValue << std::endl;
     241
     242    strValue = RpUnits::convert("20C","K",0);
     243    std::cout << "result = " << result << std::endl;
     244    std::cout << "strValue convert(20C,K,1) = " << strValue << std::endl;
     245
     246    strValue = RpUnits::convert("300K","C",1);
     247    std::cout << "result = " << result << std::endl;
     248    std::cout << "strValue convert(300K,C,1) = " << strValue << std::endl;
     249
     250    strValue = RpUnits::convert("300K","C",0);
     251    std::cout << "result = " << result << std::endl;
     252    std::cout << "strValue convert(300K,C,0) = " << strValue << std::endl;
    227253
    228254    return 0;
Note: See TracChangeset for help on using the changeset viewer.