#!/usr/bin/env python # Copyright (c) 2002 Bryce "Zooko" Wilcox-O'Hearn # portions Copyright (c) 2001 Autonomous Zone Industries # This file is licensed under the # GNU Lesser General Public License v2.1. # See the file COPYING or visit http://www.gnu.org/ for details. # import unittest from pyutil import randutil from pyutil.xor.xor import * # unit tests def _help_test(xf): assert xf('\000', '\000') == '\000' assert xf('\001', '\000') == '\001' assert xf('\001', '\001') == '\000' assert xf('\000\001', '\000\001') == '\000\000' assert xf('\100\101', '\000\101') == '\100\000' class Testy(unittest.TestCase): def test_em(self): for xorfunc in (py_xor, py_xor_simple, c_xor, xor,): if callable(xorfunc): # print "testing xorfunc ", xorfunc _help_test(xorfunc) def suite(): return unittest.makeSuite(Testy, 'test') if __name__ == '__main__': unittest.main()