root/trunk/RBRapier/test/test_doctests.py

Revision 342, 2.7 kB (checked in by sholloway, 6 years ago)

*** empty log message ***

Line 
1 #!/usr/bin/env python
2 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 ##~ License
4 ##~
5 ##- The RuneBlade Foundation library is intended to ease some
6 ##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.)
7 ##- applications, while providing the flexibility to modularly change the
8 ##- architecture. Enjoy.
9 ##~
10 ##~ Copyright (C) 2002  TechGame Networks, LLC.
11 ##~
12 ##~ This library is free software; you can redistribute it and/or
13 ##~ modify it under the terms of the BSD style License as found in the
14 ##~ LICENSE file included with this distribution.
15 ##~
16 ##~ TechGame Networks, LLC can be reached at:
17 ##~ 3578 E. Hartsel Drive #211
18 ##~ Colorado Springs, Colorado, USA, 80920
19 ##~
20 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
22 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 #~ Imports
24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25
26 from RBRapier.Tools import Vector
27 from RBRapier.Tools import Transformations
28 from RBRapier.Tools import Projections
29 from RBRapier.Tools import Quaternion
30 from RBRapier.Tools import RectangleBase
31
32 from RBRapier.Tools.Geometry.Analysis import TriangleMesh
33 from RBRapier.Tools.Geometry.Analysis import TriangleStripifier
34
35 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36 #~ Definitions
37 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38
39 TestModules = [x for x in locals().values() if isinstance(x, type(__builtins__))]
40 TestModules.remove(__builtins__)
41
42 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 #~ Testing
44 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
46 if __name__=='__main__':
47     print "Testing..."
48     print
49
50     import doctest
51     ColumnSizes = max([len(module.__name__) for module in TestModules]), 10, 10
52     FormatStringTitle = "%%-%ds %%%ds %%%ds" % ColumnSizes
53     FormatStringData = "%%-%ds %%%dd %%%dd" % ColumnSizes
54
55     print FormatStringTitle % ("="*ColumnSizes[0], "="*ColumnSizes[1], "="*ColumnSizes[2])
56     print FormatStringTitle % ("Module Tests:", "Failed", "Total")
57     print FormatStringTitle % ("-"*ColumnSizes[0], "-"*ColumnSizes[1], "-"*ColumnSizes[2])
58
59     for module in TestModules:
60         failed, total = doctest.testmod(module, report=0)
61         print FormatStringData % (module.__name__, failed, total)
62
63     print FormatStringTitle % ("-"*ColumnSizes[0], "-"*ColumnSizes[1], "-"*ColumnSizes[2])
64     print FormatStringTitle % ("Module Summary:", "Failed", "Total")
65     print FormatStringTitle % ("-"*ColumnSizes[0], "-"*ColumnSizes[1], "-"*ColumnSizes[2])
66     failed, total = doctest.master.summarize()
67     print FormatStringData % ("ALL TESTS", failed, total)
68     print FormatStringTitle % ("="*ColumnSizes[0], "="*ColumnSizes[1], "="*ColumnSizes[2])
69
70     print
71     if not failed: print "Test passed"
72     else: print "Test FAILED"
73
74
Note: See TracBrowser for help on using the browser.