Next / Previous / Contents / Shipman's homepage

41. confactest: Test driver for FoDim unit conversions

This test driver demonstrates all possible unit conversions to verify that Section 27.8, “FoDim.convert(): Convert to different units” is working correctly.

confactest
#!/usr/bin/env python
#================================================================
# confactest:  Test driver for FoDim.confactor()
#   For documentation, see:
#     http://www.nmt.edu/tcc/projects/fohelpers/
#----------------------------------------------------------------

import fosox as f

u = f.FoDim.unitList

for fromPos in range(0, len(u)):
    for toPos in range(0, len(u)):
        factor = f.FoDim.confactor(u[fromPos], u[toPos])
        print ( "To convert from %s to %s, multiply by %s" %
                (u[fromPos], u[toPos], factor) )