示例#1
0
def get_move(data):
    directions = ["north", "south", "east", "west"]
    moves = {key: 1 for key in directions}
    for test in tests.get():
        testMoves = {}
        for direction in directions:
            ## The test.run score is either a positive floating point number
            ## between 0 and 1 or None
            ## If the score is a number it is added to the
            ## overall score for that direction

            ## if the score is None then stop processing that direction
            ## and set the direction to zero as you do not want to go in that direction
            if moves[direction] == 0: continue
            testMoves[direction] = test.run(data, direction)
            if testMoves[direction] == None: moves[direction] = 0
            else: moves[direction] += test.WEIGHT * float(testMoves[direction])
        print "{0} ({1}): {2}".format(os.path.basename(test.__file__), test.WEIGHT, testMoves)
    print "Total: {0}".format(moves)
    return max(moves, key=moves.get)
def canReadGlobalCfgFile():
    root = tests.get("applocation")
    file = os.path.join(os.path.join(root, ".OpenIDE"), "oi.config")
    tests.out("command|conf read cfgfile -g")
    tests.assertOn(tests.hasOutput(file))
def canReadGlobalRootPoint():
    root = tests.get("applocation")
    tests.out("command|conf read rootpoint -g")
    tests.assertOn(tests.hasOutput(root))
def canReadGlobalCfgPoint():
    cfgfile = os.path.join(tests.get("applocation"), ".OpenIDE")
    tests.out("command|conf read cfgpoint -g")
    tests.assertOn(tests.hasOutput(cfgfile))
示例#5
0
def canReadGlobalCfgFile():
    root = tests.get("applocation")
    file = os.path.join(os.path.join(root, ".OpenIDE"), "oi.config")
    tests.out("command|conf read cfgfile -g")
    tests.assertOn(tests.hasOutput(file))
示例#6
0
def canReadGlobalRootPoint():
    root = tests.get("applocation")
    tests.out("command|conf read rootpoint -g")
    tests.assertOn(tests.hasOutput(root))
示例#7
0
def canReadGlobalCfgPoint():
    cfgfile = os.path.join(tests.get("applocation"), ".OpenIDE")
    tests.out("command|conf read cfgpoint -g")
    tests.assertOn(tests.hasOutput(cfgfile))