Source
#
# listing.py
#
# Module for testing the output of listing tasks (eg. liscal and listvis).
#
import os, sys, re, math, decimal
#=============================================================================
# METHOD: compare
#
# Compare the listvis output (test) with the listvis STANDARD.
#
# Parameters:
# test = list of strings
# STANDARD = list of strings.
#
def compare(test, standard):
testFile = open(test,'r')
testList = testFile.readlines()
standardFile = open(standard,'r')
standardList = standardFile.readlines()
if (testList == standardList):
testFile.close()
standardFile.close()
return True
else:
testFile.close()
standardFile.close()
return False
#=============================================================================
#=============================================================================
# METHOD: diffFiles
#
# Run diff on two files. Write output to a file.
#
# Parameters:
# test = string; name of runtime output file
# STANDARD = string; name of standard file
# prefix = string; prefix for diff output
#
def diffFiles(testOut, standardOut, prefix=""):
diffOut = prefix + '.diff' # diff output
print " - Running command line utility 'diff' on output files."
print " - Writing to " + diffOut
cmdstr = 'diff ' + standardOut + ' ' + testOut + ' > ' + diffOut
print cmdstr
os.system(cmdstr)
#=============================================================================
#=============================================================================
# METHOD: runTests
#
# Automate the testing of metadata and data.
#
# Parameters:
# test = string; name of runtime output file
# standard = string; name of standard file
# precision= string; lower limit of visibility precision allowed
# prefix = string; prefix for diff output
#
def runTests(test, standard, precision, prefix):