tests/test-pathencode.py
changeset 18094 8ceabb34f1cb
parent 17947 f945caa5e963
child 18110 acfc6fab1361
--- a/tests/test-pathencode.py	Mon Dec 17 20:51:21 2012 -0800
+++ b/tests/test-pathencode.py	Wed Dec 19 10:02:43 2012 +0100
@@ -13,9 +13,6 @@
 if sys.version_info[:2] < (2, 6):
     sys.exit(0)
 
-def hybridencode(path):
-    return store._hybridencode(path, True)
-
 validchars = set(map(chr, range(0, 256)))
 alphanum = range(ord('A'), ord('Z'))
 
@@ -157,7 +154,15 @@
 def runtests(rng, seed, count):
     nerrs = 0
     for p in genpath(rng, count):
-        hybridencode(p)
+        h = store._dothybridencode(p)    # uses C implementation, if available
+        r = store._hybridencode(p, True) # reference implementation in Python
+        if h != r:
+            if nerrs == 0:
+                print >> sys.stderr, 'seed:', hex(seed)[:-1]
+            print >> sys.stderr, "\np: '%s'" % p.encode("string_escape")
+            print >> sys.stderr, "h: '%s'" % h.encode("string_escape")
+            print >> sys.stderr, "r: '%s'" % r.encode("string_escape")
+            nerrs += 1
     return nerrs
 
 def main():