Changeset 5826


Ignore:
Timestamp:
Jan 11, 2018, 1:43:40 PM (5 months ago)
Author:
cameron
Message:

Some test cases for flags -v, -m

Location:
icGREP/icgrep-devel/QA
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/QA/greptest.py

    r5262 r5826  
    7878                datafile = None
    7979                expected_count = None
     80                extra_flags = None
    8081                for a in attrs:
    8182                        if a == 'regexp':
     
    8586                        elif a == 'grepcount':
    8687                                expected_count = attrs[a]
     88                        elif a == 'flags':
     89                                extra_flags = attrs[a]
    8790                if regexp == None or datafile == None or expected_count == None:
    8891                        print("Bad grepcase: missing regexp and/or datafile attributes.")
    8992                        return
    9093                #execute grep test
    91                 grep_cmd = "%s -c '%s' %s" % (grep_program_under_test, escape_quotes(regexp), os.path.join(options.datafile_dir, datafile))
     94                flags = "-c"
     95                if extra_flags != None:
     96                    flags += " " + extra_flags
     97                grep_cmd = "%s %s '%s' %s" % (grep_program_under_test, flags, escape_quotes(regexp), os.path.join(options.datafile_dir, datafile))
    9298                if options.verbose:
    9399                    print("Doing: " + grep_cmd)
     
    99105                m = re.search('[0-9]+', grep_out)
    100106                if m == None or m.group(0) != expected_count:
    101                         print("Test failure: regexp {%s} on datafile {%s} expecting {%s} got {%s}" % (regexp, datafile, expected_count, grep_out))
     107                        print("Test failure: {%s} expecting {%s} got {%s}" % (grep_cmd, expected_count, grep_out))
    102108                        failure_count += 1
    103109                else:
  • icGREP/icgrep-devel/QA/greptest.xml

    r5818 r5826  
    372372
    373373<grepcase regexp="^$" datafile="CRLF" grepcount="1"/>
     374<grepcase regexp="^$" datafile="CRLF" flags="-v" grepcount="3"/>
    374375<grepcase regexp="^.*$" datafile="CRLF" grepcount="4"/>
    375376<grepcase regexp="" datafile="CRLF" grepcount="4"/>
     
    489490<grepcase regexp="=[0-9]{50,};" datafile="bounded_charclass" grepcount="9"/>
    490491<grepcase regexp="=[0-9]{107,};" datafile="bounded_charclass" grepcount="8"/>
     492<grepcase regexp="=[0-9]{107,};" datafile="bounded_charclass" flags="-m=5" grepcount="5"/>
    491493<grepcase regexp="=0123[0-9]{107,};" datafile="bounded_charclass" grepcount="7"/>
    492494<grepcase regexp="=[0-9]{299,};" datafile="bounded_charclass" grepcount="2"/>
     
    514516<grepcase regexp="[]]" datafile="special_characters" grepcount="9"/>
    515517<grepcase regexp="[-]" datafile="special_characters" grepcount="8"/>
     518<grepcase regexp="[-]" datafile="special_characters" flags="-m=4" grepcount="4"/>
    516519<grepcase regexp="[]^-]" datafile="special_characters" grepcount="14"/>
    517520<grepcase regexp="[\-\]\^]" datafile="special_characters" grepcount="14"/>
Note: See TracChangeset for help on using the changeset viewer.