Changeset 1427 for trunk/lang


Ignore:
Timestamp:
Apr 29, 2009, 10:02:27 AM (16 years ago)
Author:
dkearney
Message:

adding tesla, gauss, weber and maxwell magnetic field units.
noticed python bindings do not validate the to_units before converting,
o stuff like mM-3 is not converted to /mm3 when given back to the user.
this is a minor bug right now.

Location:
trunk/lang
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lang/python/Rappture/PyRpUnits.cc

    r1368 r1427  
    423423
    424424    static char *kwlist[] = {
    425         (char *)"fromVal",
    426         (char *)"to",
    427         (char *)"units",
    428         NULL
     425        (char *)"fromVal",
     426        (char *)"to",
     427        (char *)"units",
     428        NULL
    429429    };
    430430
     
    433433        if (!PyArg_ParseTupleAndKeywords(args, keywds, "ss|s",
    434434                    kwlist, &fromVal, &to, &units)) {
    435             return NULL; 
     435            return NULL;
    436436        }
    437437    }
  • trunk/lang/tcl/tests/units.test

    r1157 r1427  
    884884
    885885#--------------------------------------------------------------------
     886# Magnetic Field Conversions
     887#--------------------------------------------------------------------
     888
     889test convert_units-5.4.11.0 {Rappture::Units::convert, T->G} {
     890    list [catch {Rappture::Units::convert 5T -to G} msg] $msg
     891} {0 50000G}
     892
     893test convert_units-5.4.11.1 {Rappture::Units::convert, G->T} {
     894    list [catch {Rappture::Units::convert 5G -to T} msg] $msg
     895} {0 0.0005T}
     896
     897test convert_units-5.4.11.2 {Rappture::Units::convert, G->mT} {
     898    list [catch {Rappture::Units::convert 50G -to mT} msg] $msg
     899} {0 5mT}
     900
     901test convert_units-5.4.11.3 {Rappture::Units::convert, Mx->Wb} {
     902    list [catch {Rappture::Units::convert 5Mx -to Wb} msg] $msg
     903} {0 5e-08Wb}
     904
     905test convert_units-5.4.11.4 {Rappture::Units::convert, Wb->Mx} {
     906    list [catch {Rappture::Units::convert 5e-8Wb -to Mx} msg] $msg
     907} {0 5Mx}
     908
     909test convert_units-5.4.11.5 {Rappture::Units::convert, wB->mX} {
     910    list [catch {Rappture::Units::convert 5e-8wB -to mX} msg] $msg
     911} {0 5Mx}
     912
     913#--------------------------------------------------------------------
    886914# Rappture::Units::Search::for <units>
    887915#--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.