Testing and Software Organization
4.1 Test Undefined
Both TravisCI and CodeCov are used for testing suit monitoring, and the package is available in PyPI.
src folder is where we house our core modules, which include the following:
UDFunction.py: We overload the operators in this file, such as __add__.
GraphGenerator.py: This is where we mainly achieved the reverse mode.
Calculator.py: We defined the calculation, such as sin, cos, tan, sqrt, and exp.
Utils.py: This file contains the helper functions.
API.py: We defined the trace function here to wrap all the calculation required for the users defined function.
test folder is where we house our test suits, which contains a test file for each python files inside the src folder.
We have developed the tests based on the unit test concept and the integration concept, meaning we tested for the basic functionality and also combined with other operations.
We developed a bash script to run all the tests, including the tests written under unit test concept and the integration test concept. You can test them by using the following examples:
Because we provided a command-line friendly user interface, we expect the consumer and the developers to interact with the package in the same way.
Moreover, the developers could index our derivative results for their subsequent use.
Since we distributed the package via PyPI, we provided an easy installation for both consumers and developers in modern computers.
Assuming you have git clone our repository and your current directory is the root directory, you can run the following codes to run the test cases we developed for Undefined.
1# run test suits in your command line terminal
2bash test/run_tests.sh coverage
And you will see the following as output:
4.2 The directory structure looks like the following
The tree structure of the entire project folder.
1.
2├── LICENSE
3├── README.md
4├── __init__.py
5├── codecov.yml
6├── dist
7│ ├── undefined_AD-2.1.0-py3-none-any.whl
8│ └── undefined_AD-2.1.0.tar.gz
9├── docs
10│ ├── documentation
11│ │ ├── Makefile
12│ │ ├── README.md
13│ │ ├── _build
14│ │ │ ├── doctrees
15│ │ │ │ ├── README.doctree
16│ │ │ │ ├── about.doctree
17│ │ │ │ ├── cs107-FinalProject.doctree
18│ │ │ │ ├── cs107-FinalProject.test.doctree
19│ │ │ │ ├── environment.pickle
20│ │ │ │ ├── implementation.doctree
21│ │ │ │ ├── index.doctree
22│ │ │ │ ├── modules.doctree
23│ │ │ │ ├── organization.doctree
24│ │ │ │ ├── sphinx_files
25│ │ │ │ │ ├── about.doctree
26│ │ │ │ │ ├── implementation.doctree
27│ │ │ │ │ ├── index.doctree
28│ │ │ │ │ ├── modules.doctree
29│ │ │ │ │ ├── organization.doctree
30│ │ │ │ │ ├── undefined.doctree
31│ │ │ │ │ └── usage.doctree
32│ │ │ │ ├── undefined.doctree
33│ │ │ │ └── usage.doctree
34│ │ │ └── html
35│ │ │ ├── README.html
36│ │ │ ├── _images
37│ │ │ │ ├── computational_graph_1.png
38│ │ │ │ ├── computational_graph_2.png
39│ │ │ │ ├── finalmilestone_test_success.png
40│ │ │ │ ├── milestone2_test_success.png
41│ │ │ │ ├── reverse_mode_example1.png
42│ │ │ │ ├── reverse_mode_example2.png
43│ │ │ │ └── undefined_workflow.png
44│ │ │ ├── _modules
45│ │ │ │ ├── index.html
46│ │ │ │ └── undefined
47│ │ │ │ ├── API.html
48│ │ │ │ ├── Calculator.html
49│ │ │ │ ├── GraphGenerator.html
50│ │ │ │ ├── UDFunction.html
51│ │ │ │ └── Utils.html
52│ │ │ ├── _sources
53│ │ │ │ ├── README.md.txt
54│ │ │ │ ├── about.rst.txt
55│ │ │ │ ├── cs107-FinalProject.rst.txt
56│ │ │ │ ├── cs107-FinalProject.test.rst.txt
57│ │ │ │ ├── implementation.rst.txt
58│ │ │ │ ├── index.rst.txt
59│ │ │ │ ├── modules.rst.txt
60│ │ │ │ ├── organization.rst.txt
61│ │ │ │ ├── sphinx_files
62│ │ │ │ │ ├── about.rst.txt
63│ │ │ │ │ ├── implementation.rst.txt
64│ │ │ │ │ ├── index.rst.txt
65│ │ │ │ │ ├── modules.rst.txt
66│ │ │ │ │ ├── organization.rst.txt
67│ │ │ │ │ ├── undefined.rst.txt
68│ │ │ │ │ └── usage.rst.txt
69│ │ │ │ ├── undefined.rst.txt
70│ │ │ │ └── usage.rst.txt
71│ │ │ ├── _static
72│ │ │ │ ├── alabaster.css
73│ │ │ │ ├── basic.css
74│ │ │ │ ├── css
75│ │ │ │ │ ├── badge_only.css
76│ │ │ │ │ ├── fonts
77│ │ │ │ │ │ ├── Roboto-Slab-Bold.woff
78│ │ │ │ │ │ ├── Roboto-Slab-Bold.woff2
79│ │ │ │ │ │ ├── Roboto-Slab-Regular.woff
80│ │ │ │ │ │ ├── Roboto-Slab-Regular.woff2
81│ │ │ │ │ │ ├── fontawesome-webfont.eot
82│ │ │ │ │ │ ├── fontawesome-webfont.svg
83│ │ │ │ │ │ ├── fontawesome-webfont.ttf
84│ │ │ │ │ │ ├── fontawesome-webfont.woff
85│ │ │ │ │ │ ├── fontawesome-webfont.woff2
86│ │ │ │ │ │ ├── lato-bold-italic.woff
87│ │ │ │ │ │ ├── lato-bold-italic.woff2
88│ │ │ │ │ │ ├── lato-bold.woff
89│ │ │ │ │ │ ├── lato-bold.woff2
90│ │ │ │ │ │ ├── lato-normal-italic.woff
91│ │ │ │ │ │ ├── lato-normal-italic.woff2
92│ │ │ │ │ │ ├── lato-normal.woff
93│ │ │ │ │ │ └── lato-normal.woff2
94│ │ │ │ │ └── theme.css
95│ │ │ │ ├── custom.css
96│ │ │ │ ├── doctools.js
97│ │ │ │ ├── documentation_options.js
98│ │ │ │ ├── file.png
99│ │ │ │ ├── jquery-3.5.1.js
100│ │ │ │ ├── jquery.js
101│ │ │ │ ├── js
102│ │ │ │ │ ├── badge_only.js
103│ │ │ │ │ ├── html5shiv-printshiv.min.js
104│ │ │ │ │ ├── html5shiv.min.js
105│ │ │ │ │ └── theme.js
106│ │ │ │ ├── language_data.js
107│ │ │ │ ├── minus.png
108│ │ │ │ ├── plus.png
109│ │ │ │ ├── pygments.css
110│ │ │ │ ├── searchtools.js
111│ │ │ │ ├── tabs.css
112│ │ │ │ ├── tabs.js
113│ │ │ │ ├── underscore-1.13.1.js
114│ │ │ │ └── underscore.js
115│ │ │ ├── about.html
116│ │ │ ├── cs107-FinalProject.html
117│ │ │ ├── cs107-FinalProject.test.html
118│ │ │ ├── genindex.html
119│ │ │ ├── implementation.html
120│ │ │ ├── index.html
121│ │ │ ├── modules.html
122│ │ │ ├── objects.inv
123│ │ │ ├── organization.html
124│ │ │ ├── py-modindex.html
125│ │ │ ├── search.html
126│ │ │ ├── searchindex.js
127│ │ │ ├── sphinx_files
128│ │ │ │ ├── about.html
129│ │ │ │ ├── implementation.html
130│ │ │ │ ├── index.html
131│ │ │ │ ├── modules.html
132│ │ │ │ ├── organization.html
133│ │ │ │ ├── undefined.html
134│ │ │ │ └── usage.html
135│ │ │ ├── undefined.html
136│ │ │ └── usage.html
137│ │ ├── _static
138│ │ ├── _templates
139│ │ ├── about.rst
140│ │ ├── conf.py
141│ │ ├── implementation.rst
142│ │ ├── index.rst
143│ │ ├── make.bat
144│ │ ├── modules.rst
145│ │ ├── organization.rst
146│ │ ├── undefined.rst
147│ │ └── usage.rst
148│ ├── milestone_docs
149│ │ ├── milestone1.ipynb
150│ │ ├── milestone2.ipynb
151│ │ └── milestone2_progress.ipynb
152│ └── resources
153│ ├── computational_graph_1.png
154│ ├── computational_graph_2.png
155│ ├── finalmilestone_test_success.png
156│ ├── reverse_mode_example1.png
157│ ├── reverse_mode_example2.png
158│ └── undefined_workflow.png
159├── htmlcov
160│ ├── coverage_html.js
161│ ├── d_40be0abedfd3bebf_Calculator_py.html
162│ ├── d_40be0abedfd3bebf_GraphGenerator_py.html
163│ ├── d_40be0abedfd3bebf_UDFunction_py.html
164│ ├── d_40be0abedfd3bebf_Utils_py.html
165│ ├── d_40be0abedfd3bebf___init___py.html
166│ ├── d_40be0abedfd3bebf___main___py.html
167│ ├── favicon_32.png
168│ ├── index.html
169│ ├── keybd_closed.png
170│ ├── keybd_open.png
171│ ├── status.json
172│ └── style.css
173├── pyproject.toml
174├── requirements.txt
175├── setup.cfg
176├── src
177│ ├── undefined
178│ │ ├── API.py
179│ │ ├── Calculator.py
180│ │ ├── GraphGenerator.py
181│ │ ├── UDFunction.py
182│ │ ├── Utils.py
183│ │ ├── __init__.py
184│ │ ├── __main__.py
185│ │ └── __pycache__
186│ │ ├── API.cpython-38.pyc
187│ │ ├── Calculator.cpython-38.pyc
188│ │ ├── GraphGenerator.cpython-38.pyc
189│ │ ├── UDFunction.cpython-38.pyc
190│ │ ├── Utils.cpython-38.pyc
191│ │ └── __init__.cpython-38.pyc
192│ └── undefined_AD.egg-info
193│ ├── PKG-INFO
194│ ├── SOURCES.txt
195│ ├── dependency_links.txt
196│ ├── requires.txt
197│ └── top_level.txt
198└── test
199 ├── __init__.py
200 ├── __main__.py
201 ├── __pycache__
202 │ ├── __init__.cpython-38.pyc
203 │ ├── test_API.cpython-38.pyc
204 │ ├── test_Calculator.cpython-38.pyc
205 │ ├── test_UDFunction.cpython-38.pyc
206 │ ├── test_graph_generator_operation.cpython-38.pyc
207 │ └── test_trace.cpython-38.pyc
208 ├── run_tests.sh
209 ├── test_API.py
210 ├── test_Calculator.py
211 ├── test_UDFunction.py
212 ├── test_graph_generator_operation.py
213 └── test_trace.py