from BaseHash import BaseHash
import BaseConfig

my_hash = BaseHash()
print my_hash.ULP_hash(['CSp', 0])
print my_hash.ULP_hash(['CSp', 2])
print my_hash.ULP_hash(['CSp', 2])
print my_hash.ULP_hash(['CSp', 2])
print my_hash.ULP_hash(['CSp', 2])
'''
print 'Testing ULP hash'
print my_hash.ULP_hash(['RespTime', (BaseConfig.MAX_RESP_TIME - BaseConfig.MIN_RESP_TIME)/2])
print my_hash.ULP_hash(['RespTime', -1])
print my_hash.ULP_hash(['SwapIn', (BaseConfig.MAX_SWAP_IN - BaseConfig.MIN_SWAP_IN)/2])
print my_hash.ULP_hash(['SwapIn', -1])
print my_hash.ULP_hash(['SwapOut', (BaseConfig.MAX_SWAP_OUT - BaseConfig.MIN_SWAP_OUT)/2])
print my_hash.ULP_hash(['SwapOut', -1])
print my_hash.ULP_hash(['DiskIn', (BaseConfig.MAX_DISK_IN - BaseConfig.MIN_DISK_IN)/2])
print my_hash.ULP_hash(['DiskIn', -1])
print my_hash.ULP_hash(['DiskOut', (BaseConfig.MAX_DISK_OUT - BaseConfig.MIN_DISK_OUT)/2])
print my_hash.ULP_hash(['DiskOut', -1])
print my_hash.ULP_hash(['DiskSvc', (BaseConfig.MAX_DISK_SVC - BaseConfig.MIN_DISK_SVC)/2])
print my_hash.ULP_hash(['DiskSvc', -1])
print my_hash.ULP_hash(['DiskUtil', (BaseConfig.MAX_DISK_UTIL - BaseConfig.MIN_DISK_UTIL)/2])
print my_hash.ULP_hash(['DiskUtil', -1])
print '-----1'
print my_hash.ULP_hash(['Uptime', (BaseConfig.MAX_UPTIME - BaseConfig.MIN_UPTIME)/2])
print my_hash.ULP_hash(['Uptime', -1])
print my_hash.ULP_hash(['1minLoad', (BaseConfig.MAX_1_MIN_LOAD - BaseConfig.MIN_1_MIN_LOAD)/2])
print my_hash.ULP_hash(['1minLoad', -1])
print my_hash.ULP_hash(['5minLoad', (BaseConfig.MAX_5_MIN_LOAD - BaseConfig.MIN_5_MIN_LOAD)/2])
print my_hash.ULP_hash(['5minLoad', -1])
print my_hash.ULP_hash(['15minLoad', (BaseConfig.MAX_15_MIN_LOAD - BaseConfig.MIN_15_MIN_LOAD)/2])
print my_hash.ULP_hash(['15minLoad', -1])
print my_hash.ULP_hash(['TimerMax', (BaseConfig.MAX_TIMER_MAX - BaseConfig.MIN_TIMER_MAX)/2])
print my_hash.ULP_hash(['TimerMax', -1])
print my_hash.ULP_hash(['TimerAve', (BaseConfig.MAX_TIMER_AVE - BaseConfig.MIN_TIMER_AVE)/2])
print my_hash.ULP_hash(['TimerAve', -1])
print my_hash.ULP_hash(['MemFree', (BaseConfig.MAX_MEM_FREE - BaseConfig.MIN_MEM_FREE)/2])
print my_hash.ULP_hash(['MemFree', -1])
print '-----2'
print my_hash.ULP_hash(['DiskUsed', (BaseConfig.MAX_DISK_USED - BaseConfig.MIN_DISK_USED)/2])
print my_hash.ULP_hash(['DiskUsed', -1])
print my_hash.ULP_hash(['DiskFree', (BaseConfig.MAX_DISK_FREE - BaseConfig.MIN_DISK_FREE)/2])
print my_hash.ULP_hash(['DiskFree', -1])
print my_hash.ULP_hash(['DiskSize', (BaseConfig.MAX_DISK_SIZE - BaseConfig.MIN_DISK_SIZE)/2])
print my_hash.ULP_hash(['DiskSize', -1])
print my_hash.ULP_hash(['MemActive', (BaseConfig.MAX_MEM_ACTIVE - BaseConfig.MIN_MEM_ACTIVE)/2])
print my_hash.ULP_hash(['MemActive', -1])
print my_hash.ULP_hash(['MemSize', (BaseConfig.MAX_MEM_SIZE - BaseConfig.MIN_MEM_SIZE)/2])
print my_hash.ULP_hash(['MemSize', -1])
print my_hash.ULP_hash(['SwapUsed', (BaseConfig.MAX_SWAP_USED - BaseConfig.MIN_SWAP_USED)/2])
print my_hash.ULP_hash(['SwapUsed', -1])
print '-----3'
print my_hash.ULP_hash(['KernVer', (BaseConfig.MAX_KERN_VER - BaseConfig.MIN_KERN_VER)/2])
print my_hash.ULP_hash(['KernVer', -1])
print my_hash.ULP_hash(['CPUFree', (BaseConfig.MAX_CPU_FREE - BaseConfig.MIN_CPU_FREE)/2])
print my_hash.ULP_hash(['CPUFree', -1])
print my_hash.ULP_hash(['CPUSpeed', (BaseConfig.MAX_CPU_SPEED - BaseConfig.MIN_CPU_SPEED)/2])
print my_hash.ULP_hash(['CPUSpeed', -1])
print my_hash.ULP_hash(['NumCores', (BaseConfig.MAX_NUM_CORES - BaseConfig.MIN_NUM_CORES)/2])
print my_hash.ULP_hash(['NumCores', -1])
print my_hash.ULP_hash(['CoresPerCPU', (BaseConfig.MAX_CORES_PER_CPU - BaseConfig.MIN_CORES_PER_CPU)/2])
print my_hash.ULP_hash(['CoresPerCPU', -1])
print my_hash.ULP_hash(['FCNamex', (BaseConfig.MAX_FC_NAMEX - BaseConfig.MIN_FC_NAMEX)/2])
print my_hash.ULP_hash(['FCNamex', -1])
print '-----4'
print my_hash.ULP_hash(['TxRate', (BaseConfig.MAX_TX_RATE - BaseConfig.MIN_TX_RATE)/2])
print my_hash.ULP_hash(['TxRate', -1])
print my_hash.ULP_hash(['RxRate', (BaseConfig.MAX_RX_RATE - BaseConfig.MIN_RX_RATE)/2])
print my_hash.ULP_hash(['RxRate', -1])
print my_hash.ULP_hash(['Boot', (BaseConfig.MAX_BOOT - BaseConfig.MIN_BOOT)/2])
print my_hash.ULP_hash(['Boot', -1])
print my_hash.ULP_hash(['NodeType', (BaseConfig.MAX_NODE_TYPE - BaseConfig.MIN_NODE_TYPE)/2])
print my_hash.ULP_hash(['NodeType', -1])
print my_hash.ULP_hash(['BWLimit', (BaseConfig.MAX_BW_LIMIT - BaseConfig.MIN_BW_LIMIT)/2])
print my_hash.ULP_hash(['BWLimit', -1])
print my_hash.ULP_hash(['Latitude', (BaseConfig.MAX_LATITUDE + BaseConfig.MIN_LATITUDE)/2])
print my_hash.ULP_hash(['Latitude', -199])
print '-----5'
print my_hash.ULP_hash(['Longitude', (BaseConfig.MAX_LONGITUDE + BaseConfig.MIN_LONGITUDE)/2])
print my_hash.ULP_hash(['Longitude', -199])
print my_hash.ULP_hash(['Location', (BaseConfig.MAX_LOCATION - BaseConfig.MIN_LOCATION)/2 + BaseConfig.MIN_LOCATION])
print my_hash.ULP_hash(['Location', -1])
print my_hash.ULP_hash(['Drift', (BaseConfig.MAX_DRIFT + BaseConfig.MIN_DRIFT)/2])
print my_hash.ULP_hash(['Drift', -216000])

print '\n\nTesting Partitioned ULP hash'
print my_hash.PULP_hash(['RespTime', (BaseConfig.MAX_RESP_TIME - BaseConfig.MIN_RESP_TIME)/2])
print my_hash.PULP_hash(['RespTime', -1])
print my_hash.PULP_hash(['SwapIn', (BaseConfig.MAX_SWAP_IN - BaseConfig.MIN_SWAP_IN)/2])
print my_hash.PULP_hash(['SwapIn', -1])
print my_hash.PULP_hash(['SwapOut', (BaseConfig.MAX_SWAP_OUT - BaseConfig.MIN_SWAP_OUT)/2])
print my_hash.PULP_hash(['SwapOut', -1])
print my_hash.PULP_hash(['DiskIn', (BaseConfig.MAX_DISK_IN - BaseConfig.MIN_DISK_IN)/2])
print my_hash.PULP_hash(['DiskIn', -1])
print my_hash.PULP_hash(['DiskOut', (BaseConfig.MAX_DISK_OUT - BaseConfig.MIN_DISK_OUT)/2])
print my_hash.PULP_hash(['DiskOut', -1])
print my_hash.PULP_hash(['DiskSvc', (BaseConfig.MAX_DISK_SVC - BaseConfig.MIN_DISK_SVC)/2])
print my_hash.PULP_hash(['DiskSvc', -1])
print my_hash.PULP_hash(['DiskUtil', (BaseConfig.MAX_DISK_UTIL - BaseConfig.MIN_DISK_UTIL)/2])
print my_hash.PULP_hash(['DiskUtil', -1])
print '-----1'
print my_hash.PULP_hash(['Uptime', (BaseConfig.MAX_UPTIME - BaseConfig.MIN_UPTIME)/2])
print my_hash.PULP_hash(['Uptime', -1])
print my_hash.PULP_hash(['1minLoad', (BaseConfig.MAX_1_MIN_LOAD - BaseConfig.MIN_1_MIN_LOAD)/2])
print my_hash.PULP_hash(['1minLoad', -1])
print my_hash.PULP_hash(['5minLoad', (BaseConfig.MAX_5_MIN_LOAD - BaseConfig.MIN_5_MIN_LOAD)/2])
print my_hash.PULP_hash(['5minLoad', -1])
print my_hash.PULP_hash(['15minLoad', (BaseConfig.MAX_15_MIN_LOAD - BaseConfig.MIN_15_MIN_LOAD)/2])
print my_hash.PULP_hash(['15minLoad', -1])
print my_hash.PULP_hash(['TimerMax', (BaseConfig.MAX_TIMER_MAX - BaseConfig.MIN_TIMER_MAX)/2])
print my_hash.PULP_hash(['TimerMax', -1])
print my_hash.PULP_hash(['TimerAve', (BaseConfig.MAX_TIMER_AVE - BaseConfig.MIN_TIMER_AVE)/2])
print my_hash.PULP_hash(['TimerAve', -1])
print my_hash.PULP_hash(['MemFree', (BaseConfig.MAX_MEM_FREE - BaseConfig.MIN_MEM_FREE)/2])
print my_hash.PULP_hash(['MemFree', -1])
print '-----2'
print my_hash.PULP_hash(['DiskUsed', (BaseConfig.MAX_DISK_USED - BaseConfig.MIN_DISK_USED)/2])
print my_hash.PULP_hash(['DiskUsed', -1])
print my_hash.PULP_hash(['DiskFree', (BaseConfig.MAX_DISK_FREE - BaseConfig.MIN_DISK_FREE)/2])
print my_hash.PULP_hash(['DiskFree', -1])
print my_hash.PULP_hash(['DiskSize', (BaseConfig.MAX_DISK_SIZE - BaseConfig.MIN_DISK_SIZE)/2])
print my_hash.PULP_hash(['DiskSize', -1])
print my_hash.PULP_hash(['MemActive', (BaseConfig.MAX_MEM_ACTIVE - BaseConfig.MIN_MEM_ACTIVE)/2])
print my_hash.PULP_hash(['MemActive', -1])
print my_hash.PULP_hash(['MemSize', (BaseConfig.MAX_MEM_SIZE - BaseConfig.MIN_MEM_SIZE)/2])
print my_hash.PULP_hash(['MemSize', -1])
print my_hash.PULP_hash(['SwapUsed', (BaseConfig.MAX_SWAP_USED - BaseConfig.MIN_SWAP_USED)/2])
print my_hash.PULP_hash(['SwapUsed', -1])
print '-----3'
print my_hash.PULP_hash(['KernVer', (BaseConfig.MAX_KERN_VER - BaseConfig.MIN_KERN_VER)/2])
print my_hash.PULP_hash(['KernVer', -1])
print my_hash.PULP_hash(['CPUFree', (BaseConfig.MAX_CPU_FREE - BaseConfig.MIN_CPU_FREE)/2])
print my_hash.PULP_hash(['CPUFree', -1])
print my_hash.PULP_hash(['CPUSpeed', (BaseConfig.MAX_CPU_SPEED - BaseConfig.MIN_CPU_SPEED)/2])
print my_hash.PULP_hash(['CPUSpeed', -1])
print my_hash.PULP_hash(['NumCores', (BaseConfig.MAX_NUM_CORES - BaseConfig.MIN_NUM_CORES)/2])
print my_hash.PULP_hash(['NumCores', -1])
print my_hash.PULP_hash(['CoresPerCPU', (BaseConfig.MAX_CORES_PER_CPU - BaseConfig.MIN_CORES_PER_CPU)/2])
print my_hash.PULP_hash(['CoresPerCPU', -1])
print my_hash.PULP_hash(['FCNamex', (BaseConfig.MAX_FC_NAMEX - BaseConfig.MIN_FC_NAMEX)/2])
print my_hash.PULP_hash(['FCNamex', -1])
print '-----4'
print my_hash.PULP_hash(['TxRate', (BaseConfig.MAX_TX_RATE - BaseConfig.MIN_TX_RATE)/2])
print my_hash.PULP_hash(['TxRate', -1])
print my_hash.PULP_hash(['RxRate', (BaseConfig.MAX_RX_RATE - BaseConfig.MIN_RX_RATE)/2])
print my_hash.PULP_hash(['RxRate', -1])
print my_hash.PULP_hash(['Boot', (BaseConfig.MAX_BOOT - BaseConfig.MIN_BOOT)/2])
print my_hash.PULP_hash(['Boot', -1])
print my_hash.PULP_hash(['NodeType', (BaseConfig.MAX_NODE_TYPE - BaseConfig.MIN_NODE_TYPE)/2])
print my_hash.PULP_hash(['NodeType', -1])
print my_hash.PULP_hash(['BWLimit', (BaseConfig.MAX_BW_LIMIT - BaseConfig.MIN_BW_LIMIT)/2])
print my_hash.PULP_hash(['BWLimit', -1])
print my_hash.PULP_hash(['Latitude', (BaseConfig.MAX_LATITUDE + BaseConfig.MIN_LATITUDE)/2])
print my_hash.PULP_hash(['Latitude', -199])
print '-----5'
print my_hash.PULP_hash(['Longitude', (BaseConfig.MAX_LONGITUDE + BaseConfig.MIN_LONGITUDE)/2])
print my_hash.PULP_hash(['Longitude', -199])
print my_hash.PULP_hash(['Location', (BaseConfig.MAX_LOCATION - BaseConfig.MIN_LOCATION)/2 + BaseConfig.MIN_LOCATION])
print my_hash.PULP_hash(['Location', -1])
print my_hash.PULP_hash(['Drift', (BaseConfig.MAX_DRIFT + BaseConfig.MIN_DRIFT)/2])
print my_hash.PULP_hash(['Drift', -216000])
'''

print 'Should be 1 Res: ' + str(my_hash.cell_id([['Location', 1]], 8))
print 'Should be 8 Res: ' + str(my_hash.cell_id([['Location', 5]], 8))
print 'Should be 4 Res: ' + str(my_hash.cell_id([['Location', 3]], 8))
print 'Should be [1, 1] Res: ' + str(my_hash.cell_id([['Latitude', -90], ['Longitude', -180]], 8))
print 'Should be [3, 4] Res: ' + str(my_hash.cell_id([['Latitude', -30], ['Longitude', -30]], 8))
print 'Should be [2, 3] Res: ' + str(my_hash.cell_id([['Latitude', -60], ['Longitude', -60]], 8))
print 'Should be [7, 6] Res: ' + str(my_hash.cell_id([['Latitude', 60], ['Longitude', 60]], 8))
print 'Should be [8, 8] Res: ' + str(my_hash.cell_id([['Latitude', 90], ['Longitude', 180]], 8))
print 'Should be 3 Res: ' + str(my_hash.cell_id([['CPUSpeed', 2.0]], 8))
print 'Should be 6 Res: ' + str(my_hash.cell_id([['CPUSpeed', 4.0]], 8))
print 'Should be [1, 1] Res: ' + str(my_hash.cell_id([['BWLimit', 700.0], ['DiskSize', 70.0]], 8))
print 'Should be [2, 2] Res: ' + str(my_hash.cell_id([['BWLimit', 1000.0], ['DiskSize', 100.0]], 8))
print 'Should be [4, 4] Res: ' + str(my_hash.cell_id([['BWLimit', 5000.0], ['DiskSize', 500]], 8))
print 'Should be [5, 5] Res: ' + str(my_hash.cell_id([['BWLimit', 10000.0], ['DiskSize', 1000.0]], 8))
print 'Should be [8, 8] Res: ' + str(my_hash.cell_id([['BWLimit', 100000.0], ['DiskSize', 10000.0]], 8))
print 'Should be [7] Res: ' + str(my_hash.cell_id([['NumCores', 10]], 8))
print 'Should be [2] Res: ' + str(my_hash.cell_id([['CoresPerCPU', 2]], 8))
print 'Should be [2] Res: ' + str(my_hash.cell_id([['NodeType', 2]], 8))
print 'Should be [2] Res: ' + str(my_hash.cell_id([['KernVer', 2]], 8))
print 'Should be [2] Res: ' + str(my_hash.cell_id([['FCNamex', 2]], 8))
print 'Should be [2] Res: ' + str(my_hash.cell_id([['MemSize', 12]], 8))

