Changeset 216 for test


Ignore:
Timestamp:
03/28/11 23:54:37 (13 years ago)
Author:
tim
Message:

added a new testcase to the smoketest for data attributes
fixed data naming issues in pyregfi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/pyregfi-smoketest.py

    r215 r216  
    3131# Gathers various (meaningless) statistics to exercise simple attribute access
    3232# and to hopefully smoke out any bugs that can be identified by changing stats
    33 def iterTally(hive):
     33def iterTallyNames(hive):
    3434    key_count = 0
    3535    key_lens = 0
     
    7777
    7878
     79# Uses the HiveIterator to walk all keys
     80# Gathers various (meaningless) statistics about data/data_raw attributes
     81def iterTallyData(hive):
     82    data_stat = 0.0
     83    dataraw_stat = 0.0
     84   
     85    for k in hive:
     86        for v in k.values:
     87            d = v.data
     88            if d == None:
     89                data_stat += 0.1
     90            elif hasattr(d, "__len__"):
     91                data_stat += len(d)
     92            else:
     93                data_stat += d/2.0**64
     94
     95            d = v.data_raw
     96            if d == None:
     97                dataraw_stat += 0.1
     98            else:
     99                dataraw_stat += len(d)
     100
     101    print("  Data stat: %f" % data_stat)
     102    print("  Raw data stat: %f" % dataraw_stat)
     103
     104
     105
    79106if len(sys.argv) < 2:
    80107    usage()
     
    82109
    83110
    84 tests = [("iterTally",iterTally),("iterParentWalk",iterParentWalk),]
     111#tests = [("iterTallyNames",iterTallyNames),("iterParentWalk",iterParentWalk),]
     112tests = [("iterTallyData",iterTallyData),]
    85113
    86114files = []
Note: See TracChangeset for help on using the changeset viewer.