Commit 205e6922 authored by s.gretchko's avatar s.gretchko
Browse files

Added timing for regression tests and fixed English typos

parent b2656375
......@@ -13,6 +13,7 @@ from proxtoolbox.experiments.phase.CDI_Experiment import CDI_Experiment
import numpy as np
import os
import enum
import time
def getDict(**kwargs):
return kwargs
......@@ -189,13 +190,13 @@ if __name__ == "__main__":
There are three ways to use this script:
1. Generation of the data structure used for the regression tests. This
1. Generation of the data structure used for the regression tests: This
data structure is created by parsing and extracting the relevant information
from the demo files contained in the demos folder. The data structure
is formally a list of dictionaries. Each dictionary describes a demo by specifying
the experiment class and the arguments required to instantiate an experiment.
The resulting data structure is printed in the terminal window used to run this script,
and must be copy-pasted into the script ('testData' variable)
The resulting data structure is printed in the terminal window used to run this script
and must be copy-pasted into the script (as the 'testData' variable)
Optionally, a `MAXIT` entry can be manually added to the dictionary describing each demo
If present, this will override the default number of iterations that is used
to run all the demos.
......@@ -205,9 +206,9 @@ if __name__ == "__main__":
This value describes the change in iterates when the specified
number of iterations is reached.
3. Running the regression tests. This is the most common use of this script.
3. Running the regression tests: This is the most common use of this script.
It requires that the data structure used for the tests exists and provides
a `change` entry for each demo described. The scripy runs each demo and
a `change` entry for each demo described. The script runs each demo and
the actual change in iterates is compared to the value contained in the data structure.
"""
......@@ -746,10 +747,12 @@ if __name__ == "__main__":
testEngine = TestEngine(testData, maxIterCount=5, maxError=1e-5)
# to select the appropriate mode of execution of this script
# (uncomment the one you need, and comment out the others)
# uncomment the line you need, and comment out the others
#mode = Mode.GenerateTestData
#mode = Mode.UpdateTestData
mode = Mode.RunTests
t = time.time()
if mode == Mode.GenerateTestData:
testEngine.generateTestData()
elif mode == Mode.UpdateTestData:
......@@ -757,7 +760,8 @@ if __name__ == "__main__":
else: #Mode.RunTests
success = testEngine.run()
if success:
print("All", len(testEngine.testData), "tests were sucessfull.")
print("All", len(testEngine.testData), "tests were successful.")
else:
print("Nonregression test failed", testEngine.failedCount, "demo(s) failed.")
print("Regression test failed:", testEngine.failedCount, "demo(s) failed.")
print("Took", time.time() - t, "seconds.")
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment