Exemplo n.º 1
0
def pointtest(a,b):
    keys = ['Type number', 'Type name', 'Parameter NULL vector',
            'Free Parameters', 'Branch number',
            'data', 'NCOL', 'Label', 'ISW', 'NTST',
            'Point number', 'Parameters']

    # make sure the solutions are fully parsed...
    scratch=a['Parameters']
    scratch=b['Parameters']
    for key in keys:
        if key not in a:
            raise AUTOExceptions.AUTORegressionError("No %s label"%(key,))
    if len(a["data"]) != len(b["data"]):
        raise AUTOExceptions.AUTORegressionError("Data sections have different lengths")
Exemplo n.º 2
0
def _testFilename(inputname, outputname):
    import AUTOclui, AUTOutil, runAUTO
    old_path = os.getcwd()
    log = open("log", "w")

    os.environ["LANG"] = "C"
    console = AUTOInteractiveConsole(AUTOclui.exportFunctions(log=log))
    console.execfile(inputname)
    console.close()
    log.close()
    os.chdir(old_path)
    cmd = [
        "diff", "-b", "--ignore-matching-lines='.*ab\.o.*'",
        "--ignore-matching-lines='.*cir\.o.*'",
        "--ignore-matching-lines='.*wav\.o.*'",
        "--ignore-matching-lines='   [0-9][0-9 ]  .*'",
        "--ignore-matching-lines='Finished running:.*'",
        "--ignore-matching-lines='.*Location of special point.*'",
        "--ignore-matching-lines='[uU]sing .*'",
        "--ignore-matching-lines='.*Total Time.*'", "log", outputname
    ]
    status, output = AUTOutil.getstatusoutput(cmd)
    if status != 0:
        raise AUTOExceptions.AUTORegressionError(
            "Error: log files differ:\n%s" % output)
    os.system("rm -f log")
Exemplo n.º 3
0
def pointtest(a):
    keys = [
        'NUNSTAB', 'NSTAB', 'IEQUIB', 'ITWIST', 'ISTART', 'NREV', 'IREV',
        'NFIXED', 'IFIXED', 'NPSI', 'IPSI'
    ]
    for key in keys:
        if key not in a:
            raise AUTOExceptions.AUTORegressionError("No %s label" % (key, ))
Exemplo n.º 4
0
def pointtest(a):
    keys = ['NPR', 'UZR', 'EPSS', 'ITMX', 'EPSU', 'ITNW', 'NBC',
            'IADS', 'IPS', 'IID', 'A1', 'DS', 'NMX', 'NTST',
            'NINT', 'NWTN', 'A0', 'EPSL', 'ISP', 'DSMIN', 'MXBF',
            'RL0', 'RL1', 'ICP', 'IPLT', 'ILP', 'NCOL', 'THL',
            'DSMAX', 'ISW', 'IRS', 'THU', 'IAD', 'JAC', 'NDIM']
    for key in keys:
        if key not in a:
            raise AUTOExceptions.AUTORegressionError("No %s label"%(key,))
Exemplo n.º 5
0
def test():
    print("Testing reading from a filename")
    foo = parseS()
    foo.readFilename("test_data/fort.8")    
    if len(foo) != 5:
        raise AUTOExceptions.AUTORegressionError("File length incorrect")
    pointtest(foo.getIndex(0),foo.getIndex(3))

    print("Testing reading from a stream")
    foo = parseS()
    fp = open("test_data/fort.8","rb")
    foo.read(fp)    
    if len(foo) != 5:
        raise AUTOExceptions.AUTORegressionError("File length incorrect")
    pointtest(foo.getIndex(0),foo.getIndex(3))

    
    
    print("parseS passed all tests")
Exemplo n.º 6
0
def test():
    import os
    import sys
    import AUTOutil

    log=open("log","w")
    err=open("err","w")
    stdout=sys.stdout
    class teelog(object):
        def write(self,text):
            log.write(text)
            stdout.write(text)
        def flush(self):
            log.flush()
            stdout.flush()
    runDemo("ab",log=teelog(),err=err,makefile="",
            demos_dir=os.path.join(os.environ["AUTO_DIR"],"python"),
            clean="yes")
    log.close()
    err.close()
    
    diffopts = ["diff","-b","--ignore-matching-lines='.*Total Time.*'",
                "--ignore-matching-lines='.*ab\.o.*'",
                "--ignore-matching-lines='   [0-9]  .*'"]
    status,output=AUTOutil.getstatusoutput(
        diffopts+["log","test_data/runDemo.log"])
    if status != 0:
        raise AUTOExceptions.AUTORegressionError("Log files differ")

    status,output=AUTOutil.getstatusoutput(
        diffopts+["err","test_data/runDemo.err"])
    if status != 0:
        raise AUTOExceptions.AUTORegressionError("Error files differ")
    
    os.remove("log")
    os.remove("err")
Exemplo n.º 7
0
def pointtest7(a, b):
    if "TY name" not in a:
        raise AUTOExceptions.AUTORegressionError("No TY name label")
    if "TY number" not in a:
        raise AUTOExceptions.AUTORegressionError("No TY number label")
    if "BR" not in a:
        raise AUTOExceptions.AUTORegressionError("No BR label")
    if "data" not in a:
        raise AUTOExceptions.AUTORegressionError("No data label")
    if "PT" not in a:
        raise AUTOExceptions.AUTORegressionError("No PT label")
    if "LAB" not in a:
        raise AUTOExceptions.AUTORegressionError("No LAB label")
    if len(a["data"]) != len(b["data"]):
        raise AUTOExceptions.AUTORegressionError(
            "Data sections have different lengths")
Exemplo n.º 8
0
def test():
    foo = bifDiag()
    foo.readFilename("test_data/fort.7", "test_data/fort.8")
    if len(foo[0]) != 150:
        raise AUTOExceptions.AUTORegressionError("File length incorrect")
    pointtest7(foo[0].getIndex(0), foo[0].getIndex(57))
    if len(foo()) != 5:
        raise AUTOExceptions.AUTORegressionError("File length incorrect")
    pointtest8(foo().getIndex(0), foo().getIndex(3))

    if len(foo.getLabels()) != 5:
        raise AUTOExceptions.AUTORegressionError("Incorrect number of labels")

    print("Deleting labels")
    foo.deleteLabel(range(6, 9))

    if len(foo.getLabels()) != 2:
        raise AUTOExceptions.AUTORegressionError("Incorrect number of labels")

    print("Relabeling")
    foo.relabel(9, 57)

    for i in range(len(foo[0])):
        if foo[0].getIndex(0)["TY number"] != 0:
            if foo[0].getIndex(0)["LAB"] != 57:
                raise AUTOExceptions.AUTORegressionError("Incorrect label")
            break
    if foo().getIndex(0)["Label"] != 57:
        raise AUTOExceptions.AUTORegressionError("Incorrect label")

    print("Making labels unique")
    foo.uniquelyLabel()

    for i in range(len(foo[0])):
        if foo[0].getIndex(0)["TY number"] != 0:
            if foo[0].getIndex(0)["LAB"] != 1:
                raise AUTOExceptions.AUTORegressionError("Incorrect label")
            break
    if foo().getIndex(0)["Label"] != 1:
        raise AUTOExceptions.AUTORegressionError("Incorrect label")

    print("bifDiag passed all tests")