0032340: OCCT Documentation - highlight C++ code snippets
[occt.git] / dox / contribution / tests / tests.md
CommitLineData
0a6d9742 1 Automated Testing System {#occt_contribution__tests}
72b7576f 2======================================
3
e5bd0d98 4@tableofcontents
5
dcc0a33e 6@section testmanual_intro Introduction
72b7576f 7
504a8968 8This document provides OCCT developers and contributors with an overview and practical guidelines for work with OCCT automatic testing system.
9
6d368502 10Reading the Introduction should be sufficient for developers to use the test system to control non-regression of the modifications they implement in OCCT. Other sections provide a more in-depth description of the test system, required for modifying the tests and adding new test cases.
72b7576f 11
dcc0a33e 12@subsection testmanual_intro_basic Basic Information
72b7576f 13
9d99d3c1 14OCCT automatic testing system is organized around @ref occt_user_guides__test_harness "DRAW Test Harness", a console application based on Tcl (a scripting language) interpreter extended by OCCT-related commands.
e5bd0d98 15
504a8968 16Standard OCCT tests are included with OCCT sources and are located in subdirectory *tests* of the OCCT root folder. Other test folders can be included in the test system, e.g. for testing applications based on OCCT.
e5bd0d98 17
504a8968 18The tests are organized in three levels:
72b7576f 19
504a8968 20 * Group: a group of related test grids, usually testing a particular OCCT functionality (e.g. blend);
21 * Grid: a set of test cases within a group, usually aimed at testing some particular aspect or mode of execution of the relevant functionality (e.g. buildevol);
22 * Test case: a script implementing an individual test (e.g. K4).
23
67d7f07f 24See @ref testmanual_5_1 "Test Groups" chapter for the current list of available test groups and grids.
72b7576f 25
d3013f55 26@note Many tests involve data files (typically CAD models) which are located separately and (except a few) are not included with OCCT code.
27These tests will be skipped if data files are not available.
72b7576f 28
29@subsection testmanual_1_2 Intended Use of Automatic Tests
30
31Each modification made in OCCT code must be checked for non-regression
6d368502 32by running the whole set of tests. The developer who makes the modification
504a8968 33is responsible for running and ensuring non-regression for the tests available to him.
34
6d368502 35Note that many tests are based on data files that are confidential and thus available only at OPEN CASCADE.
36The official certification testing of each change before its integration to master branch of official OCCT Git repository (and finally to the official release) is performed by OPEN CASCADE to ensure non-regression on all existing test cases and supported platforms.
504a8968 37
38Each new non-trivial modification (improvement, bug fix, new feature) in OCCT should be accompanied by a relevant test case suitable for verifying that modification. This test case is to be added by the developer who provides the modification.
72b7576f 39
504a8968 40If a modification affects the result of an existing test case, either the modification should be corrected (if it causes regression) or the affected test cases should be updated to account for the modification.
72b7576f 41
504a8968 42The modifications made in the OCCT code and related test scripts should be included in the same integration to the master branch.
72b7576f 43
44@subsection testmanual_1_3 Quick Start
45
46@subsubsection testmanual_1_3_1 Setup
47
504a8968 48Before running tests, make sure to define environment variable *CSF_TestDataPath* pointing to the directory containing test data files.
504a8968 49
50For this it is recommended to add a file *DrawAppliInit* in the directory which is current at the moment of starting DRAWEXE (normally it is OCCT root directory, <i>$CASROOT </i>). This file is evaluated automatically at the DRAW start.
51
52Example (Windows)
72b7576f 53
77d94fd1 54~~~~{.php}
504a8968 55set env(CSF_TestDataPath) $env(CSF_TestDataPath)\;d:/occt/test-data
77d94fd1 56~~~~
504a8968 57
504a8968 58Note that variable *CSF_TestDataPath* is set to default value at DRAW start, pointing at the folder <i>$CASROOT/data</i>.
87f42a3f 59In this example, subdirectory <i>d:/occt/test-data</i> is added to this path. Similar code could be used on Linux and Mac OS X except that on non-Windows platforms colon ":" should be used as path separator instead of semicolon ";".
72b7576f 60
936f43da 61All tests are run from DRAW command prompt (run *draw.bat* or *draw.sh* to start it).
72b7576f 62
63@subsubsection testmanual_1_3_2 Running Tests
64
504a8968 65To run all tests, type command *testgrid*
72b7576f 66
67Example:
68
77d94fd1 69~~~~{.php}
504a8968 70Draw[]> testgrid
77d94fd1 71~~~~
72b7576f 72
ae3eaf7b 73To run only a subset of test cases, give masks for group, grid, and test case names to be executed.
74Each argument is a list of file masks separated with commas or spaces; by default "*" is assumed.
72b7576f 75
504a8968 76Example:
72b7576f 77
77d94fd1 78~~~~{.php}
87f42a3f 79Draw[]> testgrid bugs caf,moddata*,xde
77d94fd1 80~~~~
72b7576f 81
72b7576f 82As the tests progress, the result of each test case is reported.
504a8968 83At the end of the log a summary of test cases is output,
84including the list of detected regressions and improvements, if any.
72b7576f 85
86
504a8968 87Example:
88
77d94fd1 89~~~~{.php}
72b7576f 90 Tests summary
91
92 CASE 3rdparty export A1: OK
93 ...
94 CASE pipe standard B1: BAD (known problem)
95 CASE pipe standard C1: OK
96 No regressions
97 Total cases: 208 BAD, 31 SKIPPED, 3 IMPROVEMENT, 1791 OK
98 Elapsed time: 1 Hours 14 Minutes 33.7384512019 Seconds
99 Detailed logs are saved in D:/occt/results_2012-06-04T0919
77d94fd1 100~~~~
72b7576f 101
dcc0a33e 102The tests are considered as non-regressive if only OK, BAD (i.e. known problem), and SKIPPED (i.e. not executed, typically because of lack of a data file) statuses are reported. See @ref testmanual_details_results "Interpretation of test results" for details.
72b7576f 103
936f43da 104The results and detailed logs of the tests are saved by default to a new subdirectory of the subdirectory *results* in the current folder, whose name is generated automatically using the current date and time, prefixed by Git branch name (if Git is available and current sources are managed by Git).
3f812249 105If necessary, a non-default output directory can be specified using option <i> -outdir</i> followed by a path to the directory. This directory should be new or empty; use option <i>-overwrite</i> to allow writing results in the existing non-empty directory.
72b7576f 106
504a8968 107Example:
77d94fd1 108~~~~{.php}
87f42a3f 109Draw[]> testgrid -outdir d:/occt/last_results -overwrite
77d94fd1 110~~~~
ae3eaf7b 111In the output directory, a cumulative HTML report <i>summary.html</i> provides links to reports on each test case. An additional report in JUnit-style XML format can be output for use in Jenkins or other continuous integration system.
504a8968 112
dcb359e0 113To re-run the test cases, which were detected as regressions on the previous run, option <i>-regress dirname</i> should be used.
114<i>dirname</i> is a path to the directory containing the results of the previous run. Only the test cases with *FAILED* and *IMPROVEMENT* statuses will be tested.
b502ddc1 115
116Example:
77d94fd1 117~~~~{.php}
b502ddc1 118Draw[]> testgrid -regress d:/occt/last_results
77d94fd1 119~~~~
b502ddc1 120
936f43da 121Type <i>help testgrid</i> in DRAW prompt to get help on options supported by *testgrid* command:
72b7576f 122
77d94fd1 123~~~~{.php}
504a8968 124Draw[3]> help testgrid
125testgrid: Run all tests, or specified group, or one grid
87f42a3f 126 Use: testgrid [groupmask [gridmask [casemask]]] [options...]
504a8968 127 Allowed options are:
128 -parallel N: run N parallel processes (default is number of CPUs, 0 to disable)
129 -refresh N: save summary logs every N seconds (default 60, minimal 1, 0 to disable)
130 -outdir dirname: set log directory (should be empty or non-existing)
131 -overwrite: force writing logs in existing non-empty directory
132 -xml filename: write XML report for Jenkins (in JUnit-like format)
936f43da 133 -beep: play sound signal at the end of the tests
dcb359e0 134 -regress dirname: re-run only a set of tests that have been detected as regressions on the previous run.
135 Here "dirname" is a path to the directory containing the results of the previous run.
136 Groups, grids, and test cases to be executed can be specified by the list of file
137 masks separated by spaces or commas; default is all (*).
77d94fd1 138~~~~
72b7576f 139
504a8968 140@subsubsection testmanual_1_3_3 Running a Single Test
141
87f42a3f 142To run a single test, type command *test* followed by names of group, grid, and test case.
72b7576f 143
144Example:
145
77d94fd1 146~~~~{.php}
72b7576f 147 Draw[1]> test blend simple A1
148 CASE blend simple A1: OK
149 Draw[2]>
77d94fd1 150~~~~
72b7576f 151
504a8968 152Note that normally an intermediate output of the script is not shown. The detailed log of the test can be obtained after the test execution by running command <i>"dlog get"</i>.
153
154To see intermediate commands and their output during the test execution, add one more argument
155<i>"echo"</i> at the end of the command line. Note that with this option the log is not collected and summary is not produced.
156
ae3eaf7b 157Type <i>help test</i> in DRAW prompt to get help on options supported by *test* command:
936f43da 158
77d94fd1 159~~~~{.php}
936f43da 160Draw[3]> help test
161test: Run specified test case
162 Use: test group grid casename [options...]
163 Allowed options are:
164 -echo: all commands and results are echoed immediately,
165 but log is not saved and summary is not produced
166 It is also possible to use "1" instead of "-echo"
167 If echo is OFF, log is stored in memory and only summary
168 is output (the log can be obtained with command "dlog get")
169 -outfile filename: set log file (should be non-existing),
170 it is possible to save log file in text file or
171 in html file(with snapshot), for that "filename"
172 should have ".html" extension
173 -overwrite: force writing log in existing file
174 -beep: play sound signal at the end of the test
175 -errors: show all lines from the log report that are recognized as errors
176 This key will be ignored if the "-echo" key is already set.
77d94fd1 177~~~~
936f43da 178
dcc0a33e 179@subsubsection testmanual_intro_quick_create Creating a New Test
504a8968 180
67d7f07f 181The detailed rules of creation of new tests are given in @ref testmanual_3 "Creation and modification of tests" chapter. The following short description covers the most typical situations:
504a8968 182
6d368502 183Use prefix <i>bug</i> followed by Mantis issue ID and, if necessary, additional suffixes, for naming the test script, data files, and DRAW commands specific for this test case.
504a8968 184
77d94fd1 1851. If the test requires C++ code, add it as new DRAW command(s) in one of files in *QABugs* package.
1862. Add script(s) for the test case in the subfolder corresponding to the relevant OCCT module of the group *bugs* <i>($CASROOT/tests/bugs)</i>. See @ref testmanual_5_2 "the correspondence map".
1873. In the test script:
188 * Load all necessary DRAW modules by command *pload*.
189 * Use command *locate_data_file* to get a path to data files used by test script. (Make sure to have this command not inside catch statement if it is used.)
190 * Use DRAW commands to reproduce the tested situation.
191 * Make sure that in case of failure the test produces a message containing word "Error" or other recognized by the test system as error (add new error patterns in file parse.rules if necessary).
192 * If the test case reports error due to an existing problem and the fix is not available, add @ref testmanual_3_6 "TODO" statement for each error to mark it as a known problem. The TODO statements must be specific so as to match the actually generated messages but not all similar errors.
193 * To check expected output which should be obtained as the test result, add @ref testmanual_3_7 "REQUIRED" statement for each line of output to mark it as required.
194 * If the test case produces error messages (contained in parse.rules), which are expected in that test and should not be considered as its failure (e.g. test for *checkshape* command), add REQUIRED statement for each error to mark it as required output.
1954. To check whether the data files needed for the test are already present in the database, use DRAW command *testfile* (see below).
14deaf42 196 If the data file is already present, use it for a new test instead of adding a duplicate.
197 If the data file(s) are not yet present in the test database, put them to a folder and add it to the environment variable *CSF_TestDataPath* to be found by the test system.
198 The location of the data files, which need to be accessed by OCC team and put to the official database, should be provided in the comment to Mantis issue, clearly indicating how the names of the files used by the test script match the actual names of the files.
4eb6e8f4 199 The simplest way is to attach the data files to the Mantis issue, with the same names as used by the test script.
77d94fd1 2005. Check that the test case runs as expected (test for fix: OK with the fix, FAILED without the fix; test for existing problem: BAD), and integrate it to the Git branch created for the issue.
504a8968 201
202Example:
203
204* Added files:
936f43da 205
77d94fd1 206~~~~{.php}
3f812249 207git status -short
6d368502 208A tests/bugs/heal/data/bug210_a.brep
209A tests/bugs/heal/data/bug210_b.brep
504a8968 210A tests/bugs/heal/bug210_1
211A tests/bugs/heal/bug210_2
77d94fd1 212~~~~
504a8968 213
214* Test script
215
77d94fd1 216~~~~{.php}
504a8968 217puts "OCC210 (case 1): Improve FixShape for touching wires"
218
6d368502 219restore [locate_data_file bug210_a.brep] a
504a8968 220
221fixshape result a 0.01 0.01
222checkshape result
77d94fd1 223~~~~
72b7576f 224
14deaf42 225DRAW command *testfile* should be used to check the data files used by the test for possible duplication of content or names.
226The command accepts the list of paths to files to be checked (as a single argument) and gives a conclusion on each of the files, for instance:
4eb6e8f4 227
77d94fd1 228~~~~{.php}
4eb6e8f4 229Draw[1]> testfile [glob /my/data/path/bug12345*]
230Collecting info on test data files repository...
231Checking new file(s)...
232
233* /my/data/path/bug12345.brep: duplicate
234 already present under name bug28773_1.brep
235 --> //server/occt_tests_data/public/brep/bug28773_1.brep
236
237* /my/data/path/cadso.brep: new file
238 Warning: DOS encoding detected, consider converting to
239 UNIX unless DOS line ends are needed for the test
240 Warning: shape contains triangulation (946 triangles),
241 consider removing them unless they are needed for the test!
242 BREP size=201 KiB, nbfaces=33, nbedges=94 -> private
243
244* /my/data/path/case_8_wire3.brep: already present
245 --> //server/occt_tests_data/public/brep/case_8_wire3.brep
246
247* /my/data/path/case_8_wire4.brep: error
248 name is already used by existing file
249 --> //server/occt_tests_data/public/brep/case_8_wire4.brep
77d94fd1 250~~~~
4eb6e8f4 251
72b7576f 252@section testmanual_2 Organization of Test Scripts
253
254@subsection testmanual_2_1 General Layout
255
256Standard OCCT tests are located in subdirectory tests of the OCCT root folder ($CASROOT).
72b7576f 257
504a8968 258Additional test folders can be added to the test system by defining environment variable *CSF_TestScriptsPath*. This should be list of paths separated by semicolons (*;*) on Windows
6d368502 259or colons (*:*) on Linux or Mac. Upon DRAW launch, path to *tests* subfolder of OCCT is added at the end of this variable automatically.
504a8968 260
261Each test folder is expected to contain:
6d368502 262 * Optional file *parse.rules* defining patterns for interpretation of test results, common for all groups in this folder
72b7576f 263 * One or several test group directories.
264
265Each group directory contains:
266
504a8968 267 * File *grids.list* that identifies this test group and defines list of test grids in it.
268 * Test grids (sub-directories), each containing set of scripts for test cases, and optional files *cases.list*, *parse.rules*, *begin* and *end*.
72b7576f 269 * Optional sub-directory data
72b7576f 270
504a8968 271By convention, names of test groups, grids, and cases should contain no spaces and be lower-case.
272The names *begin, end, data, parse.rules, grids.list* and *cases.list* are reserved.
72b7576f 273
504a8968 274General layout of test scripts is shown in Figure 1.
275
825c3a4a 276@figure{/contribution/tests/images/tests_image001.png,"Layout of tests folder",400}
72b7576f 277
72b7576f 278
279@subsection testmanual_2_2 Test Groups
280
281@subsubsection testmanual_2_2_1 Group Names
282
504a8968 283The names of directories of test groups containing systematic test grids correspond to the functionality tested by each group.
284
72b7576f 285Example:
286
77d94fd1 287~~~~
72b7576f 288 caf
289 mesh
290 offset
77d94fd1 291~~~~
72b7576f 292
504a8968 293Test group *bugs* is used to collect the tests coming from bug reports. Group *demo* collects tests of the test system, DRAW, samples, etc.
72b7576f 294
504a8968 295@subsubsection testmanual_2_2_2 File "grids.list"
296
297This test group contains file *grids.list*, which defines an ordered list of grids in this group in the following format:
72b7576f 298
77d94fd1 299~~~~
72b7576f 300001 gridname1
301002 gridname2
302...
303NNN gridnameN
77d94fd1 304~~~~
72b7576f 305
306Example:
307
77d94fd1 308~~~~
72b7576f 309 001 basic
310 002 advanced
77d94fd1 311~~~~
72b7576f 312
504a8968 313@subsubsection testmanual_2_2_3 File "begin"
72b7576f 314
504a8968 315This file is a Tcl script. It is executed before every test in the current group.
72b7576f 316Usually it loads necessary Draw commands, sets common parameters and defines
317additional Tcl functions used in test scripts.
504a8968 318
72b7576f 319Example:
320
77d94fd1 321~~~~{.php}
72b7576f 322 pload TOPTEST ;# load topological command
323 set cpulimit 300 ;# set maximum time allowed for script execution
77d94fd1 324~~~~
72b7576f 325
504a8968 326@subsubsection testmanual_2_2_4 File "end"
72b7576f 327
504a8968 328This file is a TCL script. It is executed after every test in the current group. Usually it checks the results of script work, makes a snap-shot of the viewer and writes *TEST COMPLETED* to the output.
72b7576f 329
504a8968 330Note: *TEST COMPLETED* string should be present in the output to indicate that the test is finished without crash.
331
67d7f07f 332See @ref testmanual_3 "Creation and modification of tests" chapter for more information.
504a8968 333
334Example:
77d94fd1 335~~~~{.php}
72b7576f 336 if { [isdraw result] } {
337 checkshape result
338 } else {
4ee1bdf4 339 puts "Error: The result shape can not be built"
72b7576f 340 }
4ee1bdf4 341 puts "TEST COMPLETED"
77d94fd1 342~~~~
504a8968 343
344@subsubsection testmanual_2_2_5 File "parse.rules"
345
346The test group may contain *parse.rules* file. This file defines patterns used for analysis of the test execution log and deciding the status of the test run.
347
348Each line in the file should specify a status (single word), followed by a regular expression delimited by slashes (*/*) that will be matched against lines in the test output log to check if it corresponds to this status.
349
7863dabb 350The regular expressions should follow <a href="https://www.tcl.tk/man/tcl/TclCmd/re_syntax.htm">Tcl syntax</a>, with a special exception that "\b" is considered as word limit (Perl-style), in addition to "\y" used in Tcl.
504a8968 351
352The rest of the line can contain a comment message, which will be added to the test report when this status is detected.
72b7576f 353
72b7576f 354Example:
355
77d94fd1 356~~~~
6d368502 357 FAILED /\b[Ee]xception\b/ exception
358 FAILED /\bError\b/ error
72b7576f 359 SKIPPED /Cannot open file for reading/ data file is missing
360 SKIPPED /Could not read file .*, abandon/ data file is missing
77d94fd1 361~~~~
72b7576f 362
363Lines starting with a *#* character and blank lines are ignored to allow comments and spacing.
72b7576f 364
dcc0a33e 365See @ref testmanual_details_results "Interpretation of test results" chapter for details.
504a8968 366
367If a line matches several rules, the first one applies. Rules defined in the grid are checked first, then rules in the group, then rules in the test root directory. This allows defining some rules on the grid level with status *IGNORE* to ignore messages that would otherwise be treated as errors due to the group level rules.
368
72b7576f 369Example:
370
77d94fd1 371~~~~
e5bd0d98 372 FAILED /\\bFaulty\\b/ bad shape
72b7576f 373 IGNORE /^Error [23]d = [\d.-]+/ debug output of blend command
374 IGNORE /^Tcl Exception: tolerance ang : [\d.-]+/ blend failure
77d94fd1 375~~~~
72b7576f 376
504a8968 377@subsubsection testmanual_2_2_6 Directory "data"
67d7f07f 378The test group may contain subdirectory *data*, where test scripts shared by different test grids can be put. See also @ref testmanual_2_3_5 "Directory data".
504a8968 379
72b7576f 380@subsection testmanual_2_3 Test Grids
381
382@subsubsection testmanual_2_3_1 Grid Names
383
504a8968 384The folder of a test group can have several sub-directories (Grid 1… Grid N) defining test grids.
385Each directory contains a set of related test cases. The name of a directory should correspond to its contents.
72b7576f 386
387Example:
388
77d94fd1 389~~~~
72b7576f 390caf
391 basic
392 bugs
393 presentation
77d94fd1 394~~~~
72b7576f 395
504a8968 396Here *caf* is the name of the test group and *basic*, *bugs*, *presentation*, etc. are the names of grids.
72b7576f 397
504a8968 398@subsubsection testmanual_2_3_2 File "begin"
399
400This file is a TCL script executed before every test in the current grid.
72b7576f 401
72b7576f 402Usually it sets variables specific for the current grid.
504a8968 403
72b7576f 404Example:
405
77d94fd1 406~~~~{.php}
72b7576f 407 set command bopfuse ;# command tested in this grid
77d94fd1 408~~~~
72b7576f 409
504a8968 410@subsubsection testmanual_2_3_3 File "end"
411
412This file is a TCL script executed after every test in current grid.
413
414Usually it executes a specific sequence of commands common for all tests in the grid.
72b7576f 415
72b7576f 416Example:
417
77d94fd1 418~~~~{.php}
936f43da 419 vdump $imagedir/${casename}.png ;# makes a snap-shot of AIS viewer
77d94fd1 420~~~~
72b7576f 421
504a8968 422@subsubsection testmanual_2_3_4 File "cases.list"
72b7576f 423
424The grid directory can contain an optional file cases.list
504a8968 425defining an alternative location of the test cases.
426This file should contain a single line defining the relative path to the collection of test cases.
72b7576f 427
428Example:
429
77d94fd1 430~~~~
72b7576f 431../data/simple
77d94fd1 432~~~~
504a8968 433
434This option is used for creation of several grids of tests with the same data files and operations but performed with differing parameters. The common scripts are usually located place in the common
435subdirectory of the test group, <i>data/simple</i> for example.
72b7576f 436
504a8968 437If file *cases.list* exists, the grid directory should not contain any test cases.
72b7576f 438The specific parameters and pre- and post-processing commands
504a8968 439for test execution in this grid should be defined in the files *begin* and *end*.
440
441
442@subsubsection testmanual_2_3_5 Directory "data"
443
444The test grid may contain subdirectory *data*, containing data files used in tests (BREP, IGES, STEP, etc.) of this grid.
72b7576f 445
446@subsection testmanual_2_4 Test Cases
447
504a8968 448The test case is a TCL script, which performs some operations using DRAW commands
449and produces meaningful messages that can be used to check the validity of the result.
450
72b7576f 451Example:
452
77d94fd1 453~~~~{.php}
72b7576f 454 pcylinder c1 10 20 ;# create first cylinder
455 pcylinder c2 5 20 ;# create second cylinder
456 ttranslate c2 5 0 10 ;# translate second cylinder to x,y,z
457 bsection result c1 c2 ;# create a section of two cylinders
458 checksection result ;# will output error message if result is bad
77d94fd1 459~~~~
72b7576f 460
504a8968 461The test case can have any name (except for the reserved names *begin, end, data, cases.list* and *parse.rules*).
72b7576f 462For systematic grids it is usually a capital English letter followed by a number.
463
464Example:
465
77d94fd1 466~~~~
72b7576f 467 A1
468 A2
469 B1
470 B2
77d94fd1 471~~~~
72b7576f 472
504a8968 473Such naming facilitates compact representation of tests execution results in tabular format within HTML reports.
72b7576f 474
72b7576f 475
476@section testmanual_3 Creation And Modification Of Tests
477
478This section describes how to add new tests and update existing ones.
479
480@subsection testmanual_3_1 Choosing Group, Grid, and Test Case Name
481
504a8968 482The new tests are usually added in the frame of processing issues in OCCT Mantis tracker.
72b7576f 483Such tests in general should be added to group bugs, in the grid
67d7f07f 484corresponding to the affected OCCT functionality. See @ref testmanual_5_2 "Mapping of OCCT functionality to grid names in group bugs".
504a8968 485
486New grids can be added as necessary to contain tests for the functionality not yet covered by existing test grids.
487The test case name in the bugs group should be prefixed by the ID of the corresponding issue in Mantis (without leading zeroes) with prefix *bug*. It is recommended to add a suffix providing a hint on the tested situation. If more than one test is added for a bug, they should be distinguished by suffixes; either meaningful or just ordinal numbers.
72b7576f 488
489Example:
490
77d94fd1 491~~~~
504a8968 492 bug12345_coaxial
493 bug12345_orthogonal_1
494 bug12345_orthogonal_2
77d94fd1 495~~~~
72b7576f 496
504a8968 497If the new test corresponds to a functionality already covered by the existing systematic test grid (e.g. group *mesh* for *BRepMesh* issues), this test can be added (or moved later by OCC team) to that grid.
72b7576f 498
499@subsection testmanual_3_2 Adding Data Files Required for a Test
500
ae3eaf7b 501It is advisable to make self-contained test scripts whenever possible, so as they could be used in the environments where data files are not available. For that simple geometric objects and shapes can be created using DRAW commands in the test script itself.
504a8968 502
ae3eaf7b 503If the test requires a data file, it should be put to the directory listed in environment variable *CSF_TestDataPath*.
936f43da 504Alternatively, it can be put to subdirectory *data* of the test grid.
505It is recommended to prefix the data file with the corresponding issue id prefixed by *bug*, e.g. *bug12345_face1.brep*, to avoid possible conflicts with names of existing data files.
504a8968 506
ae3eaf7b 507Note that when the test is integrated to the master branch, OCC team will move the data file to the data files repository, to keep OCCT sources repository clean from data files.
504a8968 508
ae3eaf7b 509When you prepare a test script, try to minimize the size of involved data model. For instance, if the problem detected on a big shape can be reproduced on a single face extracted from that shape, use only that face in the test.
504a8968 510
511
512@subsection testmanual_3_3 Adding new DRAW commands
513
514If the test cannot be implemented using available DRAW commands, consider the following possibilities:
515* If the existing DRAW command can be extended to enable possibility required for a test in a natural way (e.g. by adding an option to activate a specific mode of the algorithm), this way is recommended. This change should be appropriately documented in a relevant Mantis issue.
516* If the new command is needed to access OCCT functionality not exposed to DRAW previously, and this command can be potentially reused (for other tests), it should be added to the package where similar commands are implemented (use *getsource* DRAW command to get the package name). The name and arguments of the new command should be chosen to keep similarity with the existing commands. This change should be documented in a relevant Mantis issue.
517* Otherwise the new command implementing the actions needed for this particular test should be added in *QABugs* package. The command name should be formed by the Mantis issue ID prefixed by *bug*, e.g. *bug12345*.
518
519Note that a DRAW command is expected to return 0 in case of a normal completion, and 1 (Tcl exception) if it is incorrectly used (e.g. a wrong number of input arguments). Thus if the new command needs to report a test error, this should be done by outputting an appropriate error message rather than by returning a non-zero value.
ae3eaf7b 520File names must be encoded in the script rather than in the DRAW command and passed to the DRAW command as an argument.
504a8968 521
522@subsection testmanual_3_4 Script Implementation
523
524The test should run commands necessary to perform the tested operations, in general assuming a clean DRAW session. The required DRAW modules should be loaded by *pload* command, if it is not done by *begin* script. The messages produced by commands in a standard output should include identifiable messages on the discovered problems if any.
525
526Usually the script represents a set of commands that a person would run interactively to perform the operation and see its results, with additional comments to explain what happens.
527
72b7576f 528Example:
77d94fd1 529~~~~{.php}
504a8968 530# Simple test of fusing box and sphere
531box b 10 10 10
532sphere s 5
533bfuse result b s
534checkshape result
77d94fd1 535~~~~
72b7576f 536
504a8968 537Make sure that file *parse.rules* in the grid or group directory contains a regular expression to catch possible messages indicating the failure of the test.
538
539For instance, for catching errors reported by *checkshape* command relevant grids define a rule to recognize its report by the word *Faulty*:
540
77d94fd1 541~~~~
504a8968 542FAILED /\bFaulty\b/ bad shape
77d94fd1 543~~~~
504a8968 544
545For the messages generated in the script it is recommended to use the word 'Error' in the error message.
72b7576f 546
72b7576f 547Example:
548
77d94fd1 549~~~~{.php}
504a8968 550set expected_length 11
551if { [expr $actual_length - $expected_length] > 0.001 } {
552 puts "Error: The length of the edge should be $expected_length"
553}
77d94fd1 554~~~~
504a8968 555
556At the end, the test script should output *TEST COMPLETED* string to mark a successful completion of the script. This is often done by the *end* script in the grid.
557
81f2078c 558During execution of a test, the following Tcl variables are defined on global level:
559
560| Variable | Value |
561|-----------|-------|
562| dirname | Path to the root directory of the current set of test scripts |
563| groupname | Name of the test group (subfolder of $dirname) |
564| gridname | Name of the test grid (subfolder of $dirname/$gridname) |
565| casename | Name of the test |
566| imagedir | Path to folder where test log and other artifacts are saved |
567
568The test script can use some data stored in a separate file (e.g. reference results of the test execution).
569Such file can be put in subfolder *data* of the test grid directory.
570During execution of the test, location of such data file can be constructed using the variables listed above.
571
572Example:
573
77d94fd1 574~~~~{.php}
81f2078c 575checkresult $result $::dirname/$::groupname/$::gridname/data/${::casename}.txt
77d94fd1 576~~~~
81f2078c 577
578CAD models and other data files which are not going to change over time should be stored separately from the source repository.
579Use Tcl procedure *locate_data_file* to get a path to such data files, instead of coding the path explicitly.
580For the file to be found by that procedure, add directory that contains it into the environment variable *CSF_TestDataPath* (list of paths separated by semicolons on Windows or colons on other platforms).
581The search is recursive, thus adding only root folder of a directory containing data files is sufficient.
582If the file is not found, *locate_data_file* will raise exception, and the test will be reported as SKIPPED.
72b7576f 583
72b7576f 584Example:
585
77d94fd1 586~~~~{.php}
504a8968 587stepread [locate_data_file CAROSKI_COUPELLE.step] a *
77d94fd1 588~~~~
504a8968 589
936f43da 590When the test needs to produce some snapshots or other artefacts, use Tcl variable *imagedir* as the location where such files should be put.
ae3eaf7b 591* Command *testgrid* sets this variable to the subdirectory of the results folder corresponding to the grid.
592* Command *test* by default creates a dedicated temporary directory in the system temporary folder (normally the one specified by environment variable *TempDir*, *TEMP*, or *TMP*) for each execution, and sets *imagedir* to that location.
593
a25d5aaa 594However if variable *imagedir* is defined on the top level of Tcl interpreter, command *test* will use it instead of creating a new directory.
936f43da 595
596Use Tcl variable *casename* to prefix all files produced by the test.
597This variable is set to the name of the test case.
ae3eaf7b 598
599The test system can recognize an image file (snapshot) and include it in HTML log and differences if its name starts with the name of the test case (use variable *casename*), optionally followed by underscore or dash and arbitrary suffix.
600
936f43da 601The image format (defined by extension) should be *png*.
72b7576f 602
72b7576f 603Example:
77d94fd1 604~~~~{.php}
81f2078c 605xwd $::imagedir/${::casename}.png
504a8968 606vdisplay result; vfit
81f2078c 607vdump $::imagedir/${::casename}-axo.png
504a8968 608vfront; vfit
81f2078c 609vdump $::imagedir/${::casename}-front.png
77d94fd1 610~~~~
72b7576f 611
504a8968 612would produce:
77d94fd1 613~~~~
504a8968 614A1.png
615A1-axo.png
616A1-front.png
77d94fd1 617~~~~
72b7576f 618
504a8968 619Note that OCCT must be built with FreeImage support to be able to produce usable images.
72b7576f 620
504a8968 621In order to ensure that the test works as expected in different environments, observe the following additional rules:
622* Avoid using external commands such as *grep, rm,* etc., as these commands can be absent on another system (e.g. on Windows); use facilities provided by Tcl instead.
3f812249 623* Do not put call to *locate_data_file* in catch statement -- this can prevent correct interpretation of the missing data file by the test system.
6d368502 624* Do not use commands *decho* and *dlog* in the test script, to avoid interference with use of these commands by the test system.
72b7576f 625
dcc0a33e 626@subsection testmanual_details_results Interpretation of test results
72b7576f 627
504a8968 628The result of the test is evaluated by checking its output against patterns defined in the files *parse.rules* of the grid and group.
72b7576f 629
504a8968 630The OCCT test system recognizes five statuses of the test execution:
631* SKIPPED: reported if a line matching SKIPPED pattern is found (prior to any FAILED pattern). This indicates that the test cannot be run in the current environment; the most typical case is the absence of the required data file.
6d368502 632* FAILED: reported if a line matching pattern with status FAILED is found (unless it is masked by the preceding IGNORE pattern or a TODO or REQUIRED statement), or if message TEST COMPLETED or at least one of REQUIRED patterns is not found. This indicates that the test has produced a bad or unexpected result, and usually means a regression.
633* BAD: reported if the test script output contains one or several TODO statements and the corresponding number of matching lines in the log. This indicates a known problem. The lines matching TODO statements are not checked against other patterns and thus will not cause a FAILED status.
504a8968 634* IMPROVEMENT: reported if the test script output contains a TODO statement for which no corresponding line is found. This is a possible indication of improvement (a known problem has disappeared).
635* OK: reported if none of the above statuses have been assigned. This means that the test has passed without problems.
72b7576f 636
504a8968 637Other statuses can be specified in *parse.rules* files, these will be classified as FAILED.
72b7576f 638
504a8968 639For integration of the change to OCCT repository, all tests should return either OK or BAD status.
640The new test created for an unsolved problem should return BAD. The new test created for a fixed problem should return FAILED without the fix, and OK with the fix.
72b7576f 641
504a8968 642@subsection testmanual_3_6 Marking BAD cases
72b7576f 643
7863dabb 644If the test produces an invalid result at a certain moment then the corresponding bug should be created in the OCCT issue tracker located at https://tracker.dev.opencascade.org, and the problem should be marked as TODO in the test script.
72b7576f 645
504a8968 646The following statement should be added to such a test script:
77d94fd1 647~~~~{.php}
504a8968 648puts "TODO BugNumber ListOfPlatforms: RegularExpression"
77d94fd1 649~~~~
504a8968 650
651Here:
652* *BugNumber* is the bug ID in the tracker. For example: #12345.
863f782a 653* *ListOfPlatforms* is a list of platforms, at which the bug is reproduced (Linux, Windows, MacOS, or All). Note that the platform name is custom for the OCCT test system; Use procedure *checkplatform* to get the platform name.
72b7576f 654
655Example:
77d94fd1 656~~~~{.php}
863f782a 657Draw[2]> checkplatform
658Windows
77d94fd1 659~~~~
72b7576f 660
ae3eaf7b 661* RegularExpression is a regular expression, which should be matched against the line indicating the problem in the script output.
72b7576f 662
72b7576f 663Example:
77d94fd1 664~~~~{.php}
504a8968 665puts "TODO #22622 Mandriva2008: Abort .* an exception was raised"
77d94fd1 666~~~~
72b7576f 667
504a8968 668The parser checks the test output and if an output line matches the *RegularExpression* then it will be assigned a BAD status instead of FAILED.
72b7576f 669
504a8968 670A separate TODO line must be added for each output line matching an error expression to mark the test as BAD. If not all TODO messages are found in the test log, the test will be considered as possible improvement.
671
672To mark the test as BAD for an incomplete case (when the final *TEST COMPLETE* message is missing) the expression *TEST INCOMPLETE* should be used instead of the regular expression.
72b7576f 673
674Example:
675
77d94fd1 676~~~~{.php}
504a8968 677puts "TODO OCC22817 All: exception.+There are no suitable edges"
678puts "TODO OCC22817 All: \\*\\* Exception \\*\\*"
679puts "TODO OCC22817 All: TEST INCOMPLETE"
77d94fd1 680~~~~
72b7576f 681
6d368502 682@subsection testmanual_3_7 Marking required output
683
251a7984 684To check the obtained test output matches the expected results considered correct, add REQUIRED statement for each specific message.
685For that, the following statement should be added to the corresponding test script:
6d368502 686
77d94fd1 687~~~~{.php}
6d368502 688puts "REQUIRED ListOfPlatforms: RegularExpression"
77d94fd1 689~~~~
6d368502 690
691Here *ListOfPlatforms* and *RegularExpression* have the same meaning as in TODO statements described above.
692
251a7984 693The REQUIRED statement can also be used to mask the message that would normally be interpreted as error (according to the rules defined in *parse.rules*) but should not be considered as such within the current test.
6d368502 694
695Example:
77d94fd1 696~~~~{.php}
b502ddc1 697puts "REQUIRED Linux: Faulty shapes in variables faulty_1 to faulty_5"
77d94fd1 698~~~~
6d368502 699
700This statement notifies test system that errors reported by *checkshape* command are expected in that test case, and test should be considered as OK if this message appears, despite of presence of general rule stating that 'Faulty' signals failure.
504a8968 701
6d368502 702If output does not contain required statement, test case will be marked as FAILED.
504a8968 703
704@section testmanual_4 Advanced Use
72b7576f 705
706@subsection testmanual_4_1 Running Tests on Older Versions of OCCT
707
ae3eaf7b 708Sometimes it might be necessary to run tests on the previous versions of OCCT (<= 6.5.4) that do not include this test system. This can be done by adding DRAW configuration file *DrawAppliInit* in the directory, which is current by the moment of DRAW start-up, to load test commands and to define the necessary environment.
72b7576f 709
504a8968 710Note: in OCCT 6.5.3, file *DrawAppliInit* already exists in <i>$CASROOT/src/DrawResources</i>, new commands should be added to this file instead of a new one in the current directory.
711
712For example, let us assume that *d:/occt* contains an up-to-date version of OCCT sources with tests, and the test data archive is unpacked to *d:/test-data*):
713
77d94fd1 714~~~~{.php}
504a8968 715set env(CASROOT) d:/occt
716set env(CSF_TestScriptsPath) $env(CASROOT)/tests
717source $env(CASROOT)/src/DrawResources/TestCommands.tcl
718set env(CSF_TestDataPath) $env(CASROOT)/data;d:/test-data
719return
77d94fd1 720~~~~
504a8968 721
ae3eaf7b 722Note that on older versions of OCCT the tests are run in compatibility mode and thus not all output of the test command can be captured; this can lead to absence of some error messages (can be reported as either a failure or an improvement).
504a8968 723
724@subsection testmanual_4_2 Adding custom tests
725
726You can extend the test system by adding your own tests. For that it is necessary to add paths to the directory where these tests are located, and one or more additional data directories, to the environment variables *CSF_TestScriptsPath* and *CSF_TestDataPath*. The recommended way for doing this is using DRAW configuration file *DrawAppliInit* located in the directory which is current by the moment of DRAW start-up.
727
4ee1bdf4 728Use Tcl command <i>_path_separator</i> to insert a platform-dependent separator to the path list.
504a8968 729
730For example:
77d94fd1 731~~~~{.php}
504a8968 732set env(CSF_TestScriptsPath) \
733 $env(TestScriptsPath)[_path_separator]d:/MyOCCTProject/tests
734set env(CSF_TestDataPath) \
735 d:/occt/test-data[_path_separator]d:/MyOCCTProject/data
736return ;# this is to avoid an echo of the last command above in cout
77d94fd1 737~~~~
504a8968 738
739@subsection testmanual_4_3 Parallel execution of tests
740
741For better efficiency, on computers with multiple CPUs the tests can be run in parallel mode. This is default behavior for command *testgrid* : the tests are executed in parallel processes (their number is equal to the number of CPUs available on the system). In order to change this behavior, use option parallel followed by the number of processes to be used (1 or 0 to run sequentially).
72b7576f 742
87f42a3f 743Note that the parallel execution is only possible if Tcl extension package *Thread* is installed.
744If this package is not available, *testgrid* command will output a warning message.
72b7576f 745
504a8968 746@subsection testmanual_4_4 Checking non-regression of performance, memory, and visualization
72b7576f 747
504a8968 748Some test results are very dependent on the characteristics of the workstation, where they are performed, and thus cannot be checked by comparison with some predefined values. These results can be checked for non-regression (after a change in OCCT code) by comparing them with the results produced by the version without this change. The most typical case is comparing the result obtained in a branch created for integration of a fix (CR***) with the results obtained on the master branch before that change is made.
749
750OCCT test system provides a dedicated command *testdiff* for comparing CPU time of execution, memory usage, and images produced by the tests.
751
77d94fd1 752~~~~{.php}
504a8968 753testdiff dir1 dir2 [groupname [gridname]] [options...]
77d94fd1 754~~~~
504a8968 755Here *dir1* and *dir2* are directories containing logs of two test runs.
756
757Possible options are:
3f812249 758* <i>-save \<filename\> </i> -- saves the resulting log in a specified file (<i>$dir1/diff-$dir2.log</i> by default). HTML log is saved with the same name and extension .html;
759* <i>-status {same|ok|all}</i> -- allows filtering compared cases by their status:
77d94fd1 760 * *same* -- only cases with same status are compared (default);
761 * *ok* -- only cases with OK status in both logs are compared;
762 * *all* -- results are compared regardless of status;
3f812249 763* <i>-verbose \<level\> </i> -- defines the scope of output data:
77d94fd1 764 * 1 -- outputs only differences;
765 * 2 -- additionally outputs the list of logs and directories present in one of directories only;
766 * 3 -- (by default) additionally outputs progress messages;
44fae8b1 767* <i>-image [filename]</i> - compare images and save the resulting log in specified file (<i>$dir1/diffimage-$dir2.log</i> by default)
768* <i>-cpu [filename]</i> - compare overall CPU and save the resulting log in specified file (<i>$dir1/diffcpu-$dir2.log</i> by default)
769* <i>-memory [filename]</i> - compare memory delta and save the resulting log in specified file (<i>$dir1/diffmemory-$dir2.log</i> by default)
770* <i>-highlight_percent \<value\></i> - highlight considerable (>value in %) deviations of CPU and memory (default value is 5%)
72b7576f 771
72b7576f 772Example:
504a8968 773
77d94fd1 774~~~~{.php}
44fae8b1 775Draw[]> testdiff results/CR12345-2012-10-10T08:00 results/master-2012-10-09T21:20
77d94fd1 776~~~~
44fae8b1 777
778Particular tests can generate additional data that need to be compared by *testdiff* command.
779For that, for each parameter to be controlled, the test should produce the line containing keyword "COUNTER* followed by arbitrary name of the parameter, then colon and numeric value of the parameter.
780
781Example of test code:
782
77d94fd1 783~~~~{.php}
44fae8b1 784puts "COUNTER Memory heap usage at step 5: [meminfo h]"
77d94fd1 785~~~~
504a8968 786
787@section testmanual_5 APPENDIX
788
789@subsection testmanual_5_1 Test groups
790
791@subsubsection testmanual_5_1_1 3rdparty
792
793This group allows testing the interaction of OCCT and 3rdparty products.
794
795DRAW module: VISUALIZATION.
796
77d94fd1 797| Grid | Commands | Functionality |
504a8968 798| :---- | :----- | :------- |
77d94fd1 799| export | vexport | export of images to different formats |
800| fonts | vtrihedron, vcolorscale, vdrawtext | display of fonts |
504a8968 801
802
803@subsubsection testmanual_5_1_2 blend
804
805This group allows testing blends (fillets) and related operations.
806
807DRAW module: MODELING.
808
77d94fd1 809| Grid | Commands | Functionality |
504a8968 810| :---- | :----- | :------- |
77d94fd1 811| simple | blend | fillets on simple shapes |
812| complex | blend | fillets on complex shapes, non-trivial geometry |
813| tolblend_simple | tolblend, blend | |
814| buildevol | buildevol | |
815| tolblend_buildvol | tolblend, buildevol | use of additional command tolblend |
816| bfuseblend | bfuseblend | |
817| encoderegularity | encoderegularity | |
504a8968 818
819@subsubsection testmanual_5_1_3 boolean
820
821This group allows testing Boolean operations.
822
823DRAW module: MODELING (packages *BOPTest* and *BRepTest*).
824
825Grids names are based on name of the command used, with suffixes:
3f812249 826* <i>_2d</i> -- for tests operating with 2d objects (wires, wires, 3d objects, etc.);
827* <i>_simple</i> -- for tests operating on simple shapes (boxes, cylinders, toruses, etc.);
828* <i>_complex</i> -- for tests dealing with complex shapes.
504a8968 829
77d94fd1 830| Grid | Commands | Functionality |
504a8968 831| :---- | :----- | :------- |
77d94fd1 832| bcommon_2d | bcommon | Common operation (old algorithm), 2d |
833| bcommon_complex | bcommon | Common operation (old algorithm), complex shapes |
834| bcommon_simple | bcommon | Common operation (old algorithm), simple shapes |
835| bcut_2d | bcut | Cut operation (old algorithm), 2d |
836| bcut_complex | bcut | Cut operation (old algorithm), complex shapes |
837| bcut_simple | bcut | Cut operation (old algorithm), simple shapes |
838| bcutblend | bcutblend | |
839| bfuse_2d | bfuse | Fuse operation (old algorithm), 2d |
840| bfuse_complex | bfuse | Fuse operation (old algorithm), complex shapes |
841| bfuse_simple | bfuse | Fuse operation (old algorithm), simple shapes |
842| bopcommon_2d | bopcommon | Common operation, 2d |
843| bopcommon_complex | bopcommon | Common operation, complex shapes |
844| bopcommon_simple | bopcommon | Common operation, simple shapes |
845| bopcut_2d | bopcut | Cut operation, 2d |
846| bopcut_complex | bopcut | Cut operation, complex shapes |
847| bopcut_simple | bopcut | Cut operation, simple shapes |
848| bopfuse_2d | bopfuse | Fuse operation, 2d |
849| bopfuse_complex | bopfuse | Fuse operation, complex shapes |
850| bopfuse_simple | bopfuse | Fuse operation, simple shapes |
851| bopsection | bopsection | Section |
852| boptuc_2d | boptuc | |
853| boptuc_complex | boptuc | |
854| boptuc_simple | boptuc | |
855| bsection | bsection | Section (old algorithm) |
504a8968 856
857@subsubsection testmanual_5_1_4 bugs
858
859This group allows testing cases coming from Mantis issues.
860
861The grids are organized following OCCT module and category set for the issue in the Mantis tracker.
67d7f07f 862See @ref testmanual_5_2 "Mapping of OCCT functionality to grid names in group bugs" chapter for details.
504a8968 863
864@subsubsection testmanual_5_1_5 caf
865
866This group allows testing OCAF functionality.
867
868DRAW module: OCAFKERNEL.
869
77d94fd1 870| Grid | Commands | Functionality |
504a8968 871| :---- | :----- | :------- |
77d94fd1 872| basic | | Basic attributes |
873| bugs | | Saving and restoring of document |
874| driver | | OCAF drivers |
875| named_shape | | *TNaming_NamedShape* attribute |
876| presentation | | *AISPresentation* attributes |
877| tree | | Tree construction attributes |
878| xlink | | XLink attributes |
504a8968 879
880@subsubsection testmanual_5_1_6 chamfer
881
882This group allows testing chamfer operations.
883
884DRAW module: MODELING.
885
886The test grid name is constructed depending on the type of the tested chamfers. Additional suffix <i>_complex</i> is used for test cases involving complex geometry (e.g. intersections of edges forming a chamfer); suffix <i>_sequence</i> is used for grids where chamfers are computed sequentially.
887
77d94fd1 888| Grid | Commands | Functionality |
504a8968 889| :---- | :----- | :------- |
77d94fd1 890| equal_dist | | Equal distances from edge |
891| equal_dist_complex | | Equal distances from edge, complex shapes |
892| equal_dist_sequence | | Equal distances from edge, sequential operations |
893| dist_dist | | Two distances from edge |
894| dist_dist_complex | | Two distances from edge, complex shapes |
895| dist_dist_sequence | | Two distances from edge, sequential operations |
896| dist_angle | | Distance from edge and given angle |
897| dist_angle_complex | | Distance from edge and given angle |
898| dist_angle_sequence | | Distance from edge and given angle |
504a8968 899
943b4e5b 900@subsubsection testmanual_5_1_7 de
901
902This group tests reading and writing of CAD data files (iges, step) to and from OCCT.
903
904Test cases check transfer status, shape and attributes against expected reference values.
905
77d94fd1 906| Grid | Commands | Functionality |
943b4e5b 907| :---- | :----- | :------- |
908| iges_1, iges_2, iges_3 | igesbrep, brepiges, ReadIges, WriteIges | IGES tests |
909| step_1, step_2, step_3, step_4, step_5 | stepread, stepwrite, ReadStep, WriteStep | STEP tests |
910
911@subsubsection testmanual_5_1_8 demo
504a8968 912
913This group allows demonstrating how testing cases are created, and testing DRAW commands and the test system as a whole.
914
77d94fd1 915| Grid | Commands | Functionality |
504a8968 916| :---- | :----- | :------- |
77d94fd1 917| draw | getsource, restore | Basic DRAW commands |
918| testsystem | | Testing system |
919| samples | | OCCT samples |
504a8968 920
921
943b4e5b 922@subsubsection testmanual_5_1_9 draft
504a8968 923
924This group allows testing draft operations.
925
926DRAW module: MODELING.
927
77d94fd1 928| Grid | Commands | Functionality |
504a8968 929| :---- | :----- | :------- |
77d94fd1 930| Angle | depouille | Drafts with angle (inclined walls) |
504a8968 931
932
943b4e5b 933@subsubsection testmanual_5_1_10 feat
504a8968 934
935This group allows testing creation of features on a shape.
936
937DRAW module: MODELING (package *BRepTest*).
938
77d94fd1 939| Grid | Commands | Functionality |
504a8968 940| :---- | :----- | :------- |
77d94fd1 941| featdprism | | |
942| featlf | | |
943| featprism | | |
944| featrevol | | |
945| featrf | | |
504a8968 946
943b4e5b 947@subsubsection testmanual_5_1_11 heal
504a8968 948
949This group allows testing the functionality provided by *ShapeHealing* toolkit.
950
951DRAW module: XSDRAW
952
77d94fd1 953| Grid | Commands | Functionality |
504a8968 954| :---- | :----- | :------- |
77d94fd1 955| fix_shape | fixshape | Shape healing |
956| fix_gaps | fixwgaps | Fixing gaps between edges on a wire |
957| same_parameter | sameparameter | Fixing non-sameparameter edges |
958| same_parameter_locked | sameparameter | Fixing non-sameparameter edges |
959| fix_face_size | DT_ApplySeq | Removal of small faces |
960| elementary_to_revolution | DT_ApplySeq | Conversion of elementary surfaces to revolution |
961| direct_faces | directfaces | Correction of axis of elementary surfaces |
962| drop_small_edges | fixsmall | Removal of small edges |
963| split_angle | DT_SplitAngle | Splitting periodic surfaces by angle |
964| split_angle_advanced | DT_SplitAngle | Splitting periodic surfaces by angle |
965| split_angle_standard | DT_SplitAngle | Splitting periodic surfaces by angle |
966| split_closed_faces | DT_ClosedSplit | Splitting of closed faces |
967| surface_to_bspline | DT_ToBspl | Conversion of surfaces to b-splines |
968| surface_to_bezier | DT_ShapeConvert | Conversion of surfaces to bezier |
969| split_continuity | DT_ShapeDivide | Split surfaces by continuity criterion |
504a8968 970| split_continuity_advanced | DT_ShapeDivide | Split surfaces by continuity criterion |
971| split_continuity_standard | DT_ShapeDivide | Split surfaces by continuity criterion |
77d94fd1 972| surface_to_revolution_advanced | DT_ShapeConvertRev | Convert elementary surfaces to revolutions, complex cases |
973| surface_to_revolution_standard | DT_ShapeConvertRev | Convert elementary surfaces to revolutions, simple cases |
974| update_tolerance_locked | updatetolerance | Update the tolerance of shape so that it satisfy the rule: toler(face)<=toler(edge)<=toler(vertex) |
504a8968 975
943b4e5b 976@subsubsection testmanual_5_1_12 mesh
504a8968 977
4ee1bdf4 978This group allows testing shape tessellation (*BRepMesh*) and shading.
504a8968 979
980DRAW modules: MODELING (package *MeshTest*), VISUALIZATION (package *ViewerTest*)
981
77d94fd1 982| Grid | Commands | Functionality |
504a8968 983| :---- | :----- | :------- |
77d94fd1 984| advanced_shading | vdisplay | Shading, complex shapes |
985| standard_shading | vdisplay | Shading, simple shapes |
986| advanced_mesh | mesh | Meshing of complex shapes |
987| standard_mesh | mesh | Meshing of simple shapes |
988| advanced_incmesh | incmesh | Meshing of complex shapes |
989| standard_incmesh | incmesh | Meshing of simple shapes |
504a8968 990| advanced_incmesh_parallel | incmesh | Meshing of complex shapes, parallel mode |
991| standard_incmesh_parallel | incmesh | Meshing of simple shapes, parallel mode |
992
943b4e5b 993@subsubsection testmanual_5_1_13 mkface
504a8968 994
995This group allows testing creation of simple surfaces.
996
997DRAW module: MODELING (package *BRepTest*)
998
77d94fd1 999| Grid | Commands | Functionality |
504a8968 1000| :---- | :----- | :------- |
77d94fd1 1001| after_trim | mkface | |
1002| after_offset | mkface | |
1003| after_extsurf_and_offset | mkface | |
1004| after_extsurf_and_trim | mkface | |
1005| after_revsurf_and_offset | mkface | |
1006| mkplane | mkplane | |
504a8968 1007
943b4e5b 1008@subsubsection testmanual_5_1_14 nproject
504a8968 1009
1010This group allows testing normal projection of edges and wires onto a face.
1011
1012DRAW module: MODELING (package *BRepTest*)
1013
77d94fd1 1014| Grid | Commands | Functionality |
504a8968 1015| :---- | :----- | :------- |
77d94fd1 1016| Base | nproject | |
504a8968 1017
943b4e5b 1018@subsubsection testmanual_5_1_15 offset
504a8968 1019
1020This group allows testing offset functionality for curves and surfaces.
1021
1022DRAW module: MODELING (package *BRepTest*)
1023
77d94fd1 1024| Grid | Commands | Functionality |
504a8968 1025| :---- | :----- | :------- |
77d94fd1 1026| compshape | offsetcompshape | Offset of shapes with removal of some faces |
1027| faces_type_a | offsetparameter, offsetload, offsetperform | Offset on a subset of faces with a fillet |
1028| faces_type_i | offsetparameter, offsetload, offsetperform | Offset on a subset of faces with a sharp edge |
1029| shape_type_a | offsetparameter, offsetload, offsetperform | Offset on a whole shape with a fillet |
1030| shape_type_i | offsetparameter, offsetload, offsetperform | Offset on a whole shape with a fillet |
1031| shape | offsetshape | |
1032| wire_closed_outside_0_005, wire_closed_outside_0_025, wire_closed_outside_0_075, wire_closed_inside_0_005, wire_closed_inside_0_025, wire_closed_inside_0_075, wire_unclosed_outside_0_005, wire_unclosed_outside_0_025, wire_unclosed_outside_0_075 | mkoffset | 2d offset of closed and unclosed planar wires with different offset step and directions of offset ( inside / outside ) |
1033
943b4e5b 1034@subsubsection testmanual_5_1_16 pipe
504a8968 1035
1036This group allows testing construction of pipes (sweeping of a contour along profile).
1037
1038DRAW module: MODELING (package *BRepTest*)
1039
77d94fd1 1040| Grid | Commands | Functionality |
504a8968 1041| :---- | :----- | :------- |
77d94fd1 1042| Standard | pipe | |
504a8968 1043
943b4e5b 1044@subsubsection testmanual_5_1_17 prism
504a8968 1045
1046This group allows testing construction of prisms.
1047
1048DRAW module: MODELING (package *BRepTest*)
1049
77d94fd1 1050| Grid | Commands | Functionality |
504a8968 1051| :---- | :----- | :------- |
77d94fd1 1052| seminf | prism | |
504a8968 1053
943b4e5b 1054@subsubsection testmanual_5_1_18 sewing
504a8968 1055
1056This group allows testing sewing of faces by connecting edges.
1057
1058DRAW module: MODELING (package *BRepTest*)
1059
77d94fd1 1060| Grid | Commands | Functionality |
504a8968 1061| :---- | :----- | :------- |
77d94fd1 1062| tol_0_01 | sewing | Sewing faces with tolerance 0.01 |
1063| tol_1 | sewing | Sewing faces with tolerance 1 |
504a8968 1064| tol_100 | sewing | Sewing faces with tolerance 100 |
1065
943b4e5b 1066@subsubsection testmanual_5_1_19 thrusection
504a8968 1067
1068This group allows testing construction of shell or a solid passing through a set of sections in a given sequence (loft).
1069
77d94fd1 1070| Grid | Commands | Functionality |
504a8968 1071| :---- | :----- | :------- |
77d94fd1 1072| solids | thrusection | Lofting with resulting solid |
1073| not_solids | thrusection | Lofting with resulting shell or face |
504a8968 1074
943b4e5b 1075@subsubsection testmanual_5_1_20 xcaf
504a8968 1076
1077This group allows testing extended data exchange packages.
1078
77d94fd1 1079| Grid | Commands | Functionality |
504a8968 1080| :---- | :----- | :------- |
77d94fd1 1081| dxc, dxc_add_ACL, dxc_add_CL, igs_to_dxc, igs_add_ACL, brep_to_igs_add_CL, stp_to_dxc, stp_add_ACL, brep_to_stp_add_CL, brep_to_dxc, add_ACL_brep, brep_add_CL | | Subgroups are divided by format of source file, by format of result file and by type of document modification. For example, *brep_to_igs* means that the source shape in brep format was added to the document, which was saved into igs format after that. The postfix *add_CL* means that colors and layers were initialized in the document before saving and the postfix *add_ACL* corresponds to the creation of assembly and initialization of colors and layers in a document before saving. |
1082
504a8968 1083
1084@subsection testmanual_5_2 Mapping of OCCT functionality to grid names in group *bugs*
1085
77d94fd1 1086| OCCT Module / Mantis category | Toolkits | Test grid in group bugs |
504a8968 1087| :---------- | :--------- | :---------- |
77d94fd1 1088| Application Framework | PTKernel, TKPShape, TKCDF, TKLCAF, TKCAF, TKBinL, TKXmlL, TKShapeSchema, TKPLCAF, TKBin, TKXml, TKPCAF, FWOSPlugin, TKStdLSchema, TKStdSchema, TKTObj, TKBinTObj, TKXmlTObj | caf |
1089| Draw | TKDraw, TKTopTest, TKViewerTest, TKXSDRAW, TKDCAF, TKXDEDRAW, TKTObjDRAW, TKQADraw, DRAWEXE, Problems of testing system | draw |
504a8968 1090| Shape Healing | TKShHealing | heal |
77d94fd1 1091| Mesh | TKMesh, TKXMesh | mesh |
1092| Data Exchange | TKIGES | iges |
1093| Data Exchange | TKSTEPBase, TKSTEPAttr, TKSTEP209, TKSTEP | step |
1094| Data Exchange | TKSTL, TKVRML | stlvrml |
1095| Data Exchange | TKXSBase, TKXCAF, TKXCAFSchema, TKXDEIGES, TKXDESTEP, TKXmlXCAF, TKBinXCAF | xde |
1096| Foundation Classes | TKernel, TKMath | fclasses |
1097| Modeling_algorithms | TKGeomAlgo, TKTopAlgo, TKPrim, TKBO, TKBool, TKHLR, TKFillet, TKOffset, TKFeat, TKXMesh | modalg |
1098| Modeling Data | TKG2d, TKG3d, TKGeomBase, TKBRep | moddata |
1099| Visualization | TKService, TKV2d, TKV3d, TKOpenGl, TKMeshVS, TKNIS | vis |
504a8968 1100
1101
5ae01c85 1102@subsection testmanual_5_3 Recommended approaches to checking test results
504a8968 1103
1104@subsubsection testmanual_5_3_1 Shape validity
1105
1106Run command *checkshape* on the result (or intermediate) shape and make sure that *parse.rules* of the test grid or group reports bad shapes (usually recognized by word "Faulty") as error.
1107
1108Example
77d94fd1 1109~~~~{.php}
504a8968 1110checkshape result
77d94fd1 1111~~~~
504a8968 1112
5ae01c85 1113To check the number of faults in the shape command *checkfaults* can be used.
1114
1115Use: checkfaults shape source_shape [ref_value=0]
1116
1117The default syntax of *checkfaults* command:
77d94fd1 1118~~~~{.php}
5ae01c85 1119checkfaults results a_1
77d94fd1 1120~~~~
5ae01c85 1121
1122The command will check the number of faults in the source shape (*a_1*) and compare it
1123with number of faults in the resulting shape (*result*). If shape *result* contains
1124more faults, you will get an error:
77d94fd1 1125~~~~{.php}
5ae01c85 1126checkfaults results a_1
1127Error : Number of faults is 5
77d94fd1 1128~~~~
5ae01c85 1129It is possible to set the reference value for comparison (reference value is 4):
1130
77d94fd1 1131~~~~{.php}
5ae01c85 1132checkfaults results a_1 4
77d94fd1 1133~~~~
5ae01c85 1134
1135If number of faults in the resulting shape is unstable, reference value should be set to "-1".
1136As a result command *checkfaults* will return the following error:
1137
77d94fd1 1138~~~~{.php}
5ae01c85 1139checkfaults results a_1 -1
1140Error : Number of faults is UNSTABLE
77d94fd1 1141~~~~
5ae01c85 1142
504a8968 1143@subsubsection testmanual_5_3_2 Shape tolerance
dcb359e0 1144
504a8968 1145The maximal tolerance of sub-shapes of each kind of the resulting shape can be extracted from output of tolerance command as follows:
1146
77d94fd1 1147~~~~{.php}
504a8968 1148set tolerance [tolerance result]
1149regexp { *FACE +: +MAX=([-0-9.+eE]+)} $tolerance dummy max_face
1150regexp { *EDGE +: +MAX=([-0-9.+eE]+)} $tolerance dummy max_edgee
1151regexp { *VERTEX +: +MAX=([-0-9.+eE]+)} $tolerance dummy max_vertex
77d94fd1 1152~~~~
504a8968 1153
5ae01c85 1154It is possible to use command *checkmaxtol* to check maximal tolerance of shape and compare it with reference value.
1155
fb60057d 1156Use: checkmaxtol shape [options...]
5ae01c85 1157
1158Allowed options are:
dcb359e0 1159 * <i>-ref</i> -- reference value of maximum tolerance;
1160 * <i>-source</i> -- list of shapes to compare with;
1161 * <i>-min_tol</i> -- minimum tolerance for comparison;
1162 * <i>-multi_tol</i> -- tolerance multiplier.
5ae01c85 1163
5ae01c85 1164The default syntax of *checkmaxtol* command for comparison with the reference value:
77d94fd1 1165~~~~{.php}
fb60057d 1166checkmaxtol result -ref 0.00001
77d94fd1 1167~~~~
5ae01c85 1168
1169There is an opportunity to compare max tolerance of resulting shape with max tolerance of source shape.
1170In the following example command *checkmaxtol* gets max tolerance among objects *a_1* and *a_2*.
1171Then it chooses the maximum value between founded tolerance and value -min_tol (0.000001)
1172and multiply it on the coefficient -multi_tol (i.e. 2):
1173
77d94fd1 1174~~~~{.php}
fb60057d 1175checkmaxtol result -source {a_1 a_2} -min_tol 0.000001 -multi_tol 2
77d94fd1 1176~~~~
5ae01c85 1177
1178If the value of maximum tolerance more than founded tolerance for comparison, the command will return an error.
1179
fb60057d 1180Also, command *checkmaxtol* can be used to get max tolerance of the shape:
1181
77d94fd1 1182~~~~{.php}
fb60057d 1183set maxtol [checkmaxtol result]
77d94fd1 1184~~~~
fb60057d 1185
504a8968 1186@subsubsection testmanual_5_3_3 Shape volume, area, or length
1187
1188Use command *vprops, sprops,* or *lprops* to correspondingly measure volume, area, or length of the shape produced by the test. The value can be extracted from the result of the command by *regexp*.
1189
1190Example:
77d94fd1 1191~~~~{.php}
504a8968 1192# check area of shape result with 1% tolerance
1193regexp {Mass +: +([-0-9.+eE]+)} [sprops result] dummy area
1194if { abs($area - $expected) > 0.1 + 0.01 * abs ($area) } {
1195 puts "Error: The area of result shape is $area, while expected $expected"
1196}
77d94fd1 1197~~~~
504a8968 1198
1199@subsubsection testmanual_5_3_4 Memory leaks
1200
dcb359e0 1201The test system measures the amount of memory used by each test case. Considerable deviations (as well as the overall difference) in comparison with reference results can be reported by command *testdiff* (see @ref testmanual_4_4).
504a8968 1202
dcb359e0 1203To check memory leak on a particular operation, run it in a cycle, measure the memory consumption at each step and compare it with a threshold value.
1204The command *checktrend* (defined in *tests/bugs/begin*) can be used to analyze a sequence of memory measurements and to get a statistically based evaluation of the leak presence.
504a8968 1205
1206Example:
77d94fd1 1207~~~~{.php}
504a8968 1208set listmem {}
1209for {set i 1} {$i < 100} {incr i} {
1210 # run suspect operation
1211 …
1212 # check memory usage (with tolerance equal to half page size)
1213 lappend listmem [expr [meminfo w] / 1024]
1214 if { [checktrend $listmem 0 256 "Memory leak detected"] } {
1215 puts "No memory leak, $i iterations"
1216 break
1217 }
1218}
77d94fd1 1219~~~~
504a8968 1220
1221@subsubsection testmanual_5_3_5 Visualization
1222
dcb359e0 1223The following command sequence allows you to take a snapshot of the viewer, give it the name of the test case, and save in the directory indicated by Tcl variable *imagedir*.
504a8968 1224
77d94fd1 1225~~~~{.php}
504a8968 1226vinit
1227vclear
1228vdisplay result
1229vsetdispmode 1
1230vfit
1231vzfit
1232vdump $imagedir/${casename}_shading.png
77d94fd1 1233~~~~
504a8968 1234
1235This image will be included in the HTML log produced by *testgrid* command and will be checked for non-regression through comparison of images by command *testdiff*.
5ae01c85 1236
5747059b 1237Also it is possible to use command *checkview* to make a snapshot of the viewer.
1238
1239Use: checkview [options...]
1240Allowed options are:
dcb359e0 1241* <i>-display shapename </i> -- displays shape with name *shapename*;
1242* <i>-3d </i> -- displays shape in 3d viewer;
1243* <i>-2d [ v2d / smallview ] </i> - displays shape in 2d viewer (the default viewer is *smallview*);
1244* <i>-path PATH</i> -- sets the location of the saved viewer screenshot;
1245* <i>-vdispmode N</i> -- sets *vdispmode* for 3d viewer (default value is 1)
1246* <i>-screenshot</i> -- makes a screenshot of already created viewer
1247* The procedure can check a property of shape (length, area or volume) and compare it with value *N*:
77d94fd1 1248 * <i>-l [N]</i>
1249 * <i>-s [N]</i>
1250 * <i>-v [N]</i>
1251 * If the current property is equal to value *N*, the shape is marked as valid in the procedure.
1252 * If value *N* is not given, the procedure will mark the shape as valid if the current property is non-zero.
dcb359e0 1253* <i>-with {a b c}</i> -- displays shapes *a, b* and *c* together with the shape (if the shape is valid)
1254* <i>-otherwise {d e f}</i> -- displays shapes *d, e* and *f* instead of the shape (if the shape is NOT valid)
1255
1256Note that is required to use either option <i> -2d </i> or option <i> -3d</i>.
5747059b 1257
1258Examples:
77d94fd1 1259~~~~{.php}
5747059b 1260checkview -display result -2d -path ${imagedir}/${test_image}.png
1261checkview -display result -3d -path ${imagedir}/${test_image}.png
1262checkview -display result_2d -2d v2d -path ${imagedir}/${test_image}.png
77d94fd1 1263~~~~
dcb359e0 1264
77d94fd1 1265~~~~{.php}
5747059b 1266box a 10 10 10
1267box b 5 5 5 10 10 10
1268bcut result b a
1269set result_vertices [explode result v]
1270checkview -display result -2d -with ${result_vertices} -otherwise { a b } -l -path ${imagedir}/${test_image}.png
77d94fd1 1271~~~~
dcb359e0 1272
77d94fd1 1273~~~~{.php}
5747059b 1274box a 10 10 10
1275box b 5 5 5 10 10 10
1276bcut result b a
1277vinit
1278vdisplay a b
1279vfit
1280checkview -screenshot -3d -path ${imagedir}/${test_image}.png
77d94fd1 1281~~~~
5747059b 1282
5ae01c85 1283@subsubsection testmanual_5_3_6 Number of free edges
1284
dcb359e0 1285Procedure *checkfreebounds* compares the number of free edges with a reference value.
5ae01c85 1286
1287Use: checkfreebounds shape ref_value [options...]
1288
1289Allowed options are:
dcb359e0 1290 * <i>-tol N</i> -- used tolerance (default -0.01);
1291 * <i>-type N</i> -- used type, possible values are "closed" and "opened" (default "closed").
5ae01c85 1292
77d94fd1 1293~~~~{.php}
5ae01c85 1294checkfreebounds result 13
77d94fd1 1295~~~~
5ae01c85 1296
dcb359e0 1297Option <i>-tol N</i> defines tolerance for command *freebounds*, which is used within command *checkfreebounds*.
5ae01c85 1298
dcb359e0 1299Option <i>-type N</i> is used to select the type of counted free edges: closed or open.
5ae01c85 1300
dcb359e0 1301If the number of free edges in the resulting shape is unstable, the reference value should be set to "-1".
5ae01c85 1302As a result command *checkfreebounds* will return the following error:
1303
77d94fd1 1304~~~~{.php}
5ae01c85 1305checkfreebounds result -1
1306Error : Number of free edges is UNSTABLE
77d94fd1 1307~~~~
5ae01c85 1308
1309@subsubsection testmanual_5_3_7 Compare numbers
1310
dcb359e0 1311Procedure *checkreal* checks the equality of two reals with a tolerance (relative and absolute).
5ae01c85 1312
1313Use: checkreal name value expected tol_abs tol_rel
1314
77d94fd1 1315~~~~{.php}
5ae01c85 1316checkreal "Some important value" $value 5 0.0001 0.01
77d94fd1 1317~~~~
5ae01c85 1318
1319@subsubsection testmanual_5_3_8 Check number of sub-shapes
1320
dcb359e0 1321Procedure *checknbshapes* compares the number of sub-shapes in "shape" with the given reference data.
5ae01c85 1322
1323Use: checknbshapes shape [options...]
dcb359e0 1324
5ae01c85 1325Allowed options are:
dcb359e0 1326 * <i>-vertex N
5ae01c85 1327 * -edge N
1328 * -wire N
1329 * -face N
1330 * -shell N
1331 * -solid N
1332 * -compsolid N
1333 * -compound N
1334 * -shape N
dcb359e0 1335 * -t</i> -- compares the number of sub-shapes in "shape" counting
5ae01c85 1336 the same sub-shapes with different location as different sub-shapes.
dcb359e0 1337 * <i>-m msg</i> -- prints "msg" in case of error
5ae01c85 1338
77d94fd1 1339~~~~{.php}
5ae01c85 1340checknbshapes result -vertex 8 -edge 4
77d94fd1 1341~~~~
5ae01c85 1342
1343@subsubsection testmanual_5_3_9 Check pixel color
1344
dcb359e0 1345Command *checkcolor* can be used to check pixel color.
5ae01c85 1346
1347Use: checkcolor x y red green blue
1348
dcb359e0 1349where:
1350 * <i>x, y</i> -- pixel coordinates;
1351 * <i>red green blue</i> -- expected pixel color (values from 0 to 1).
5ae01c85 1352
dcb359e0 1353This procedure checks color with tolerance (5x5 area).
5ae01c85 1354
1355Next example will compare color of point with coordinates x=100 y=100 with RGB color R=1 G=0 B=0.
1356If colors are not equal, procedure will check the nearest ones points (5x5 area)
77d94fd1 1357~~~~{.php}
5ae01c85 1358checkcolor 100 100 1 0 0
77d94fd1 1359~~~~
728ae8f9 1360
1361@subsubsection testmanual_5_3_10 Compute length, area and volume of input shape
1362
dcb359e0 1363Procedure *checkprops* computes length, area and volume of the input shape.
728ae8f9 1364
1365Use: checkprops shapename [options...]
1366
1367Allowed options are:
dcb359e0 1368 * <i>-l LENGTH</i> -- command *lprops*, computes the mass properties of all edges in the shape with a linear density of 1;
1369 * <i>-s AREA</i> -- command *sprops*, computes the mass properties of all faces with a surface density of 1;
1370 * <i>-v VOLUME</i> -- command *vprops*, computes the mass properties of all solids with a density of 1;
1371 * <i>-eps EPSILON</i> -- the epsilon defines relative precision of computation;
4d597f3e 1372 * <i>-deps DEPSILON</i> -- the epsilon defines relative precision to compare corresponding values;
dcb359e0 1373 * <i>-equal SHAPE</i> -- compares area, volume and length of input shapes. Puts error if they are not equal;
1374 * <i>-notequal SHAPE</i> -- compares area, volume and length of input shapes. Puts error if they are equal.
728ae8f9 1375
dcb359e0 1376Options <i> -l, -s </i> and <i> -v</i> are independent and can be used in any order. Tolerance *epsilon* is the same for all options.
728ae8f9 1377
77d94fd1 1378~~~~{.php}
728ae8f9 1379checkprops result -s 6265.68
1380checkprops result -s -equal FaceBrep
77d94fd1 1381~~~~
728ae8f9 1382
1383@subsubsection testmanual_5_3_11 Parse output dump and compare it with reference values
1384
1385Procedure *checkdump* is used to parse output dump and compare it with reference values.
1386
1387Use: checkdump shapename [options...]
1388
1389Allowed options are:
dcb359e0 1390 * <i>-name NAME</i> -- list of parsing parameters (e.g. Center, Axis, etc.);
1391 * <i>-ref VALUE</i> -- list of reference values for each parameter in *NAME*;
1392 * <i>-eps EPSILON</i> -- the epsilon defines relative precision of computation.
728ae8f9 1393
77d94fd1 1394~~~~{.php}
728ae8f9 1395checkdump result -name {Center Axis XAxis YAxis Radii} -ref {{-70 0} {-1 -0} {-1 -0} {0 -1} {20 10}} -eps 0.01
77d94fd1 1396~~~~
728ae8f9 1397
1398@subsubsection testmanual_5_3_12 Compute length of input curve
1399
dcb359e0 1400Procedure *checklength* computes length of the input curve.
728ae8f9 1401
1402Use: checklength curvename [options...]
1403
1404Allowed options are:
dcb359e0 1405 * <i>-l LENGTH</i> -- command *length*, computes the length of the input curve with precision of computation;
1406 * <i>-eps EPSILON</i> -- the epsilon defines a relative precision of computation;
1407 * <i>-equal CURVE</i> -- compares the length of input curves. Puts error if they are not equal;
1408 * <i>-notequal CURVE</i> -- compares the length of input curves. Puts error if they are equal.
728ae8f9 1409
77d94fd1 1410~~~~{.php}
728ae8f9 1411checklength cp1 -l 7.278
1412checklength res -l -equal ext_1
77d94fd1 1413~~~~
5d7a0489 1414@subsubsection testmanual_5_3_13 Check maximum deflection, number of triangles and nodes in mesh
1415
dcb359e0 1416Command *checktrinfo* can be used to to check the maximum deflection, as well as the number of nodes and triangles in mesh.
5d7a0489 1417
1418Use: checktrinfo shapename [options...]
1419
1420Allowed options are:
dcb359e0 1421 * <i>-tri [N]</i> -- compares the current number of triangles in *shapename* mesh with the given reference data.
1422 If reference value N is not given and the current number of triangles is equal to 0, procedure *checktrinfo* will print an error.
1423 * <i>-nod [N]</i> -- compares the current number of nodes in *shapename* mesh with the given reference data.
1424 If reference value N is not given and the current number of nodes is equal to 0, procedure *checktrinfo* will print an error.
1425 * <i>-defl [N]</i> -- compares the current value of maximum deflection in *shapename* mesh with the given reference data.
1426 If reference value N is not given and current maximum deflection is equal to 0, procedure *checktrinfo* will print an error.
1427 * <i>-max_defl N</i> -- compares the current value of maximum deflection in *shapename* mesh with the max possible value.
1428 * <i>-tol_abs_tri N</i> -- absolute tolerance for comparison of number of triangles (default value 0).
1429 * <i>-tol_rel_tri N</i> -- relative tolerance for comparison of number of triangles (default value 0).
1430 * <i>-tol_abs_nod N</i> -- absolute tolerance for comparison of number of nodes (default value 0).
1431 * <i>-tol_rel_nod N</i> -- relative tolerance for comparison of number of nodes (default value 0).
1432 * <i>-tol_abs_defl N</i> -- absolute tolerance for deflection comparison (default value 0).
1433 * <i>-tol_rel_defl N</i> -- relative tolerance for deflection comparison (default value 0).
1434 * <i>-ref [trinfo a]</i> -- compares deflection, number of triangles and nodes in *shapename* and *a*.
1435
1436Note that options <i> -tri, -nod </i> and <i> -defl </i> do not work together with option <i> -ref</i>.
5d7a0489 1437
1438Examples:
1439
dcb359e0 1440Comparison with some reference values:
77d94fd1 1441~~~~{.php}
5d7a0489 1442checktrinfo result -tri 129 -nod 131 -defl 0.01
77d94fd1 1443~~~~
5d7a0489 1444
dcb359e0 1445Comparison with another mesh:
77d94fd1 1446~~~~{.php}
5d7a0489 1447checktrinfo result -ref [tringo a]
77d94fd1 1448~~~~
5d7a0489 1449
dcb359e0 1450Comparison of deflection with the max possible value:
77d94fd1 1451~~~~{.php}
5d7a0489 1452checktrinfo result -max_defl 1
77d94fd1 1453~~~~
5d7a0489 1454
dcb359e0 1455Check that the current values are not equal to zero:
77d94fd1 1456~~~~{.php}
5d7a0489 1457checktrinfo result -tri -nod -defl
77d94fd1 1458~~~~
5d7a0489 1459
dcb359e0 1460Check that the number of triangles and the number of nodes are not equal to some specific values:
77d94fd1 1461~~~~{.php}
5d7a0489 1462checktrinfo result -tri !10 -nod !8
77d94fd1 1463~~~~
5d7a0489 1464
dcb359e0 1465It is possible to compare current values with reference values with some tolerances.
1466Use options <i>-tol_\* </i> for that.
77d94fd1 1467~~~~{.php}
5d7a0489 1468checktrinfo result -defl 1 -tol_abs_defl 0.001
77d94fd1 1469~~~~
d6b4d3d0 1470