Index: pkpgcounter/trunk/pkpgpdls/tiff.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/tiff.py (revision 387)
+++ pkpgcounter/trunk/pkpgpdls/tiff.py (revision 415)
@@ -79,26 +79,4 @@
         return pagecount
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/pdlparser.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/pdlparser.py (revision 387)
+++ pkpgcounter/trunk/pkpgpdls/pdlparser.py (revision 415)
@@ -110,2 +110,25 @@
         else :        
             raise PDLParserError, "Impossible to compute ink coverage for this file format."
+            
+def test(parserclass) :        
+    """Test function."""
+    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
+        sys.argv.append("-")
+    totalsize = 0    
+    for arg in sys.argv[1:] :
+        if arg == "-" :
+            infile = sys.stdin
+            mustclose = 0
+        else :    
+            infile = open(arg, "rb")
+            mustclose = 1
+        try :
+            parser = parserclass(infile, debug=1)
+            totalsize += parser.getJobSize()
+        except PDLParserError, msg :    
+            sys.stderr.write("ERROR: %s\n" % msg)
+            sys.stderr.flush()
+        if mustclose :    
+            infile.close()
+    print "%s" % totalsize
+    
Index: pkpgcounter/trunk/pkpgpdls/ooo.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/ooo.py (revision 387)
+++ pkpgcounter/trunk/pkpgpdls/ooo.py (revision 415)
@@ -64,26 +64,4 @@
         return pagecount
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/zjstream.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/zjstream.py (revision 387)
+++ pkpgcounter/trunk/pkpgpdls/zjstream.py (revision 415)
@@ -104,26 +104,4 @@
         return max(startpagecount, endpagecount)
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/qpdl.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/qpdl.py (revision 387)
+++ pkpgcounter/trunk/pkpgpdls/qpdl.py (revision 415)
@@ -294,26 +294,4 @@
         return self.pagecount
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/pdf.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/pdf.py (revision 387)
+++ pkpgcounter/trunk/pkpgpdls/pdf.py (revision 415)
@@ -105,26 +105,4 @@
         return pagecount    
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/oldpcl345.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/oldpcl345.py (revision 402)
+++ pkpgcounter/trunk/pkpgpdls/oldpcl345.py (revision 415)
@@ -486,26 +486,4 @@
         return pagecount
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/postscript.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/postscript.py (revision 389)
+++ pkpgcounter/trunk/pkpgpdls/postscript.py (revision 415)
@@ -191,26 +191,4 @@
         return max(nbpages, newnbpages)    
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/pcl345.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/pcl345.py (revision 406)
+++ pkpgcounter/trunk/pkpgpdls/pcl345.py (revision 415)
@@ -539,26 +539,4 @@
         return self.pagecount
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/escp2.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/escp2.py (revision 387)
+++ pkpgcounter/trunk/pkpgpdls/escp2.py (revision 415)
@@ -76,26 +76,4 @@
             return int(pagecount1 / 2)       
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/spl1.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/spl1.py (revision 410)
+++ pkpgcounter/trunk/pkpgpdls/spl1.py (revision 415)
@@ -128,26 +128,4 @@
         return self.pagecount
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/pclxl.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/pclxl.py (revision 387)
+++ pkpgcounter/trunk/pkpgpdls/pclxl.py (revision 415)
@@ -657,26 +657,4 @@
         return self.pagecount
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
Index: pkpgcounter/trunk/pkpgpdls/dvi.py
===================================================================
--- pkpgcounter/trunk/pkpgpdls/dvi.py (revision 387)
+++ pkpgcounter/trunk/pkpgpdls/dvi.py (revision 415)
@@ -75,26 +75,4 @@
         return pagecount
         
-def test() :        
-    """Test function."""
-    if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) :
-        sys.argv.append("-")
-    totalsize = 0    
-    for arg in sys.argv[1:] :
-        if arg == "-" :
-            infile = sys.stdin
-            mustclose = 0
-        else :    
-            infile = open(arg, "rb")
-            mustclose = 1
-        try :
-            parser = Parser(infile, debug=1)
-            totalsize += parser.getJobSize()
-        except pdlparser.PDLParserError, msg :    
-            sys.stderr.write("ERROR: %s\n" % msg)
-            sys.stderr.flush()
-        if mustclose :    
-            infile.close()
-    print "%s" % totalsize
-    
 if __name__ == "__main__" :    
-    test()
+    pdlparser.test(Parser)
