regexp.py 709 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/python -u
  2. import libxml2
  3. # Memory debug specific
  4. libxml2.debugMemory(1)
  5. re = libxml2.regexpCompile("a|b")
  6. if re.regexpExec("a") != 1:
  7. print "error checking 'a'"
  8. sys.exit(1)
  9. if re.regexpExec("b") != 1:
  10. print "error checking 'b'"
  11. sys.exit(1)
  12. if re.regexpExec("ab") != 0:
  13. print "error checking 'ab'"
  14. sys.exit(1)
  15. if re.regexpExec("") != 0:
  16. print "error checking 'ab'"
  17. sys.exit(1)
  18. if re.regexpIsDeterminist() != 1:
  19. print "error checking determinism"
  20. sys.exit(1)
  21. del re
  22. # Memory debug specific
  23. libxml2.cleanupParser()
  24. if libxml2.debugMemory(1) == 0:
  25. print "OK"
  26. else:
  27. print "Memory leak %d bytes" % (libxml2.debugMemory(1))
  28. libxml2.dumpMemory()