author | Tommaso Pecorella <tommaso.pecorella@unifi.it> |
Fri, 11 Sep 2015 10:52:44 +0200 | |
changeset 11666 | e8634b0101f7 |
parent 11538 | 397bd6465dd9 |
permissions | -rw-r--r-- |
150
663120712cd9
fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
131
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
9
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
3 |
* Copyright (c) 2009 University of Washington |
9
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
*/ |
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
|
5342
3c6109eec550
bug 675: kill old test framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5324
diff
changeset
|
19 |
#ifndef NS3_TEST_H |
3c6109eec550
bug 675: kill old test framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5324
diff
changeset
|
20 |
#define NS3_TEST_H |
9
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
|
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
22 |
#include <iostream> |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
23 |
#include <fstream> |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
24 |
#include <sstream> |
9
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include <string> |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
26 |
#include <vector> |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
27 |
#include <list> |
4773
904c1803d5dc
test framework should probably work on all supported machines
Craig Dowell <craigdo@ee.washington.edu>
parents:
4772
diff
changeset
|
28 |
#include <limits> |
4774
066f73df2229
fc11 is pretty picky about headers
Craig Dowell <craigdo@ee.washington.edu>
parents:
4773
diff
changeset
|
29 |
#include <stdint.h> |
5457
8cb18165e22f
Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents:
5441
diff
changeset
|
30 |
|
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
31 |
#include "non-copyable.h" |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
32 |
#include "system-wall-clock-ms.h" |
5457
8cb18165e22f
Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents:
5441
diff
changeset
|
33 |
|
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
34 |
/** |
11356 | 35 |
* \file |
36 |
* \ingroup testing |
|
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
37 |
* \brief Definition of the testing macros and declaration of |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
38 |
* the testing classes. |
11356 | 39 |
*/ |
40 |
||
41 |
/** |
|
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
42 |
* \ingroup core |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
43 |
* \defgroup testing Testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
44 |
* \brief Tools to define and execute unit tests. |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
45 |
* |
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
46 |
* This module lists the normal Testing API. Most of these |
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
47 |
* macros forward to the implementation macros in testingimpl. |
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
48 |
* You should generally use these macros only. |
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
49 |
*/ |
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
50 |
/** |
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
51 |
* \ingroup testing |
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
52 |
* \defgroup testingimpl Testing Implementation |
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
53 |
* \brief Internal implementation of the Testing system. |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
54 |
*/ |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
55 |
|
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
56 |
// |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
57 |
// Note on below macros: |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
58 |
// |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
59 |
// When multiple statements are used in a macro, they should be bound |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
60 |
// together in a loop syntactically, so the macro can appear safely |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
61 |
// inside if clauses or other places that expect a single statement or |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
62 |
// a statement block. The "strange" do while construct is a generally |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
63 |
// expected best practice for defining a robust macro. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
64 |
// |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
65 |
|
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
66 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
67 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
68 |
* \brief Check if we should assert on errors, and do so |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
69 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
70 |
#define ASSERT_ON_FAILURE \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
71 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
72 |
if (MustAssertOnFailure ()) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
73 |
{ \ |
7745
fcf4778c9b16
bug 1371: llvm complains about invalid dereference of zero
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7685
diff
changeset
|
74 |
*(volatile int *)0 = 0; \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
75 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
76 |
} while (false) |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
77 |
|
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
78 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
79 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
80 |
* \brief If we shouldn't continue on errors, return |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
81 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
82 |
#define CONTINUE_ON_FAILURE \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
83 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
84 |
if (!MustContinueOnFailure ()) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
85 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
86 |
return; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
87 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
88 |
} while (false) |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
89 |
|
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
90 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
91 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
92 |
* \brief If we shouldn't continue on errors, return test status |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
93 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
94 |
#define CONTINUE_ON_FAILURE_RETURNS_BOOL \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
95 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
96 |
if (!MustContinueOnFailure ()) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
97 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
98 |
return IsStatusFailure (); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
99 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
100 |
} while (false) |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
101 |
|
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
102 |
|
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
103 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
104 |
// =========================================================================== |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
105 |
// Test for equality (generic version) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
106 |
// =========================================================================== |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
107 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
108 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
109 |
* \ingroup testingimpl |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
110 |
* \brief Test that an actual and expected (limit) value are equal and report |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
111 |
* and abort if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
112 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
113 |
#define NS_TEST_ASSERT_MSG_EQ_INTERNAL(actual, limit, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
114 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
115 |
if (!((actual) == (limit))) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
116 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
117 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
118 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
119 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
120 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
121 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
122 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
123 |
limitStream << limit; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
124 |
ReportTestFailure (std::string (#actual) + " (actual) == " + \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
125 |
std::string (#limit) + " (limit)", \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
126 |
actualStream.str (), limitStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
127 |
msgStream.str (), file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
128 |
CONTINUE_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
129 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
130 |
} while (false) |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
131 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
132 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
133 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
134 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
135 |
* \brief Test that an actual and expected (limit) value are equal and |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
136 |
* report and abort if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
137 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
138 |
* Check to see if the expected (limit) value is equal to the actual |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
139 |
* value found in a test case. If the two values are equal nothing |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
140 |
* happens, but if the comparison fails, an error is reported in a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
141 |
* consistent way and the execution of the current test case is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
142 |
* aborted. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
143 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
144 |
* The message is interpreted as a stream, for example: |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
145 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
146 |
* \code |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
147 |
* NS_TEST_ASSERT_MSG_EQ (result, true, |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
148 |
* "cannot open file " << filename << " in test"); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
149 |
* \endcode |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
150 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
151 |
* is legal. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
152 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
153 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
154 |
* \param [in] limit Expression for the expected value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
155 |
* \param [in] msg Message that is output if the test does not pass. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
156 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
157 |
* \warning Do not use this macro if you are comparing floating point |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
158 |
* numbers (float or double) as it is unlikely to do what you expect. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
159 |
* Use NS_TEST_ASSERT_MSG_EQ_TOL instead. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
160 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
161 |
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg) \ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
162 |
NS_TEST_ASSERT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
163 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
164 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
165 |
* \ingroup testingimpl |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
166 |
* \brief Test that an actual and expected (limit) value are equal and report |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
167 |
* and abort if not. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
168 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
169 |
#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
170 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
171 |
if (!((actual) == (limit))) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
172 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
173 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
174 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
175 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
176 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
177 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
178 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
179 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
180 |
ReportTestFailure (std::string (#actual) + " (actual) == " + \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
181 |
std::string (#limit) + " (limit)", \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
182 |
actualStream.str (), limitStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
183 |
msgStream.str (), file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
184 |
CONTINUE_ON_FAILURE_RETURNS_BOOL; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
185 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
186 |
} while (false) |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
187 |
|
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
188 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
189 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
190 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
191 |
* \brief Test that an actual and expected (limit) value are equal and |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
192 |
* report and abort if not. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
193 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
194 |
* Check to see if the expected (limit) value is equal to the actual |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
195 |
* value found in a test case. If the two values are equal nothing |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
196 |
* happens, but if the comparison fails, an error is reported in a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
197 |
* consistent way and the execution of the current test case is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
198 |
* aborted. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
199 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
200 |
* The message is interpreted as a stream, for example: |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
201 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
202 |
* \code |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
203 |
* NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (result, true, |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
204 |
* "cannot open file " << filename << " in test"); |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
205 |
* \endcode |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
206 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
207 |
* is legal. |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
208 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
209 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
210 |
* \param [in] limit Expression for the expected value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
211 |
* \param [in] msg Message that is output if the test does not pass. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
212 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
213 |
* \warning Do not use this macro if you are comparing floating point |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
214 |
* numbers (float or double) as it is unlikely to do what you expect. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
215 |
* Use NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_TOL instead. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
216 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
217 |
* This function returns a boolean value. |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
218 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
219 |
*/ |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
220 |
#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL(actual, limit, msg) \ |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
221 |
NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
222 |
|
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
223 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
224 |
* \ingroup testingimpl |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
225 |
* \brief Test that an actual and expected (limit) value are equal and |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
226 |
* report if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
227 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
228 |
* Required to avoid use of return statement which allows use in |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
229 |
* methods (esp. callbacks) returning void. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
230 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
231 |
#define NS_TEST_EXPECT_MSG_EQ_INTERNAL(actual, limit, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
232 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
233 |
if (!((actual) == (limit))) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
234 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
235 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
236 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
237 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
238 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
239 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
240 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
241 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
242 |
ReportTestFailure (std::string (#actual) + " (actual) == " + \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
243 |
std::string (#limit) + " (limit)", \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
244 |
actualStream.str (), limitStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
245 |
msgStream.str (), file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
246 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
247 |
} while (false) |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
248 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
249 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
250 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
251 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
252 |
* \brief Test that an actual and expected (limit) value are equal and |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
253 |
* report if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
254 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
255 |
* Check to see if the expected (lmit) value is equal to the actual |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
256 |
* value found in a test case. If the two values are equal nothing |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
257 |
* happens, but if the comparison fails, an error is reported in a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
258 |
* consistent way. EXPECT* macros do not return if an error is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
259 |
* detected. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
260 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
261 |
* The message is interpreted as a stream, for example: |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
262 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
263 |
* \code |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
264 |
* NS_TEST_EXPECT_MSG_EQUAL (result, true, |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
265 |
* "cannot open file " << filename << " in test"); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
266 |
* \endcode |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
267 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
268 |
* is legal. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
269 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
270 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
271 |
* \param [in] limit Expression for the expected value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
272 |
* \param [in] msg Message that is output if the test does not pass. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
273 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
274 |
* \warning Do not use this macro if you are comparing floating point |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
275 |
* numbers (float or double) as it is unlikely to do what you expect. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
276 |
* Use NS_TEST_EXPECT_MSG_EQ_TOL instead. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
277 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
278 |
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg) \ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
279 |
NS_TEST_EXPECT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
280 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
281 |
// =========================================================================== |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
282 |
// Test for equality with a provided tolerance (use for floating point |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
283 |
// comparisons -- both float and double) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
284 |
// =========================================================================== |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
285 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
286 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
287 |
* \ingroup testingimpl |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
288 |
* \brief Test that actual and expected (limit) values are equal to |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
289 |
* plus or minus some tolerance and report and abort if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
290 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
291 |
#define NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
292 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
293 |
if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
294 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
295 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
296 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
297 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
298 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
299 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
300 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
301 |
limitStream << limit << " +- " << tol; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
302 |
std::ostringstream condStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
303 |
condStream << #actual << " (actual) < " << #limit \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
304 |
<< " (limit) + " << #tol << " (tol) && " \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
305 |
<< #actual << " (actual) > " << #limit \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
306 |
<< " (limit) - " << #tol << " (tol)"; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
307 |
ReportTestFailure (condStream.str (), actualStream.str (), \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
308 |
limitStream.str (), msgStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
309 |
file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
310 |
CONTINUE_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
311 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
312 |
} while (false) |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
313 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
314 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
315 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
316 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
317 |
* \brief Test that actual and expected (limit) values are equal to |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
318 |
* plus or minus some tolerance and report and abort if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
319 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
320 |
* Check to see if the expected (limit) value is equal to the actual |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
321 |
* value found in a test case to some tolerance. This is not the same |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
322 |
* thing as asking if two floating point are equal to within some |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
323 |
* epsilon, but is useful for that case. This assertion is geared |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
324 |
* toward more of a measurement problem. Consider measuring a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
325 |
* physical rod of some kind that you have ordered. You need to |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
326 |
* determine if it is "good." You want to measure the rod to an |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
327 |
* arbitrary precision of sixteen significant figures, you will |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
328 |
* measure the rod to determine if its length is within the tolerances |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
329 |
* you provided. For example, 12.00 inches plus or minus .005 inch |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
330 |
* may be just fine. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
331 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
332 |
* In ns-3, you might want to measure a signal to noise ratio and |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
333 |
* check to see if the answer is what you expect. If you naively |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
334 |
* measure (double)1128.93 and compare this number with a constant |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
335 |
* 1128.93 you are almost certainly going to have your test fail |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
336 |
* because of floating point rounding errors. We provide a floating |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
337 |
* point comparison function ns3::TestDoubleIsEqual() but you will |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
338 |
* probably quickly find that is not what you want either. It may |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
339 |
* turn out to be the case that when you measured an snr that printed |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
340 |
* as 1128.93, what was actually measured was something more like |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
341 |
* 1128.9287653857625442 for example. Given that the double epsilon |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
342 |
* is on the order of 0.0000000000000009, you would need to provide |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
343 |
* sixteen significant figures of expected value for this kind of test |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
344 |
* to pass even with a typical test for floating point "approximate |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
345 |
* equality." That is clearly not required or desired. You really |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
346 |
* want to be able to provide 1128.93 along with a tolerance just like |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
347 |
* you provided 12 inches +- 0.005 inch above. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
348 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
349 |
* This assertion is designed for real measurements by taking into |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
350 |
* account measurement tolerances. By doing so it also automatically |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
351 |
* compensates for floating point rounding errors. If you really want |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
352 |
* to check floating point equality down to the |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
353 |
* numeric_limits<double>::epsilon () range, consider using |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
354 |
* ns3::TestDoubleIsEqual(). |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
355 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
356 |
* \note Mixing signed and unsigned types can lead to misleading |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
357 |
* results. |
10591
5770becb0bcb
Mixing signed and unsigned types can lead to misleading results in NS_TEST macros.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10587
diff
changeset
|
358 |
* |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
359 |
* The message is interpreted as a stream, for example: |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
360 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
361 |
* \code |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
362 |
* NS_TEST_ASSERT_MSG_EQ_TOL (snr, 1128.93, 0.005, |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
363 |
* "wrong snr (" << snr << ") in test"); |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
364 |
* \endcode |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
365 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
366 |
* is legal. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
367 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
368 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
369 |
* \param [in] limit Expression for the expected value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
370 |
* \param [in] tol Tolerance of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
371 |
* \param [in] msg Message that is output if the test does not pass. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
372 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
373 |
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg) \ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
374 |
NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
375 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
376 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
377 |
* \ingroup testingimpl |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
378 |
* \brief Test that actual and expected (limit) values are equal to |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
379 |
* plus or minus some tolerance and report and abort if not. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
380 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
381 |
#define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL(actual, limit, tol, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
382 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
383 |
if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
384 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
385 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
386 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
387 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
388 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
389 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
390 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
391 |
limitStream << limit << " +- " << tol; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
392 |
std::ostringstream condStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
393 |
condStream << #actual << " (actual) < " << #limit \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
394 |
<< " (limit) + " << #tol << " (tol) && " \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
395 |
<< #actual << " (actual) > " << #limit \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
396 |
<< " (limit) - " << #tol << " (tol)"; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
397 |
ReportTestFailure (condStream.str (), actualStream.str (), \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
398 |
limitStream.str (), msgStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
399 |
file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
400 |
CONTINUE_ON_FAILURE_RETURNS_BOOL; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
401 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
402 |
} while (false) |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
403 |
|
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
404 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
405 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
406 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
407 |
* \brief Test that actual and expected (limit) values are equal to |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
408 |
* plus or minus some tolerance and report and abort if not. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
409 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
410 |
* Check to see if the expected (limit) value is equal to the actual |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
411 |
* value found in a test case to some tolerance. This is not the same |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
412 |
* thing as asking if two floating point are equal to within some |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
413 |
* epsilon, but is useful for that case. This assertion is geared |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
414 |
* toward more of a measurement problem. Consider measuring a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
415 |
* physical rod of some kind that you have ordered. You need to |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
416 |
* determine if it is "good." You want to measure the rod to an |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
417 |
* arbitrary precision of sixteen significant figures, you will |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
418 |
* measure the rod to determine if its length is within the tolerances |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
419 |
* you provided. For example, 12.00 inches plus or minus .005 inch |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
420 |
* may be just fine. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
421 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
422 |
* In ns-3, you might want to measure a signal to noise ratio and |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
423 |
* check to see if the answer is what you expect. If you naively |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
424 |
* measure (double)1128.93 and compare this number with a constant |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
425 |
* 1128.93 you are almost certainly going to have your test fail |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
426 |
* because of floating point rounding errors. We provide a floating |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
427 |
* point comparison function ns3::TestDoubleIsEqual() but you will |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
428 |
* probably quickly find that is not what you want either. It may |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
429 |
* turn out to be the case that when you measured an snr that printed |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
430 |
* as 1128.93, what was actually measured was something more like |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
431 |
* 1128.9287653857625442 for example. Given that the double epsilon |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
432 |
* is on the order of 0.0000000000000009, you would need to provide |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
433 |
* sixteen significant figures of expected value for this kind of test |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
434 |
* to pass even with a typical test for floating point "approximate |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
435 |
* equality." That is clearly not required or desired. You really |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
436 |
* want to be able to provide 1128.93 along with a tolerance just like |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
437 |
* you provided 12 inches +- 0.005 inch above. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
438 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
439 |
* This assertion is designed for real measurements by taking into |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
440 |
* account measurement tolerances. By doing so it also automatically |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
441 |
* compensates for floating point rounding errors. If you really want |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
442 |
* to check floating point equality down to the |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
443 |
* numeric_limits<double>::epsilon () range, consider using |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
444 |
* ns3::TestDoubleIsEqual(). |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
445 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
446 |
* \note Mixing signed and unsigned types can lead to misleading |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
447 |
* results. |
10591
5770becb0bcb
Mixing signed and unsigned types can lead to misleading results in NS_TEST macros.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10587
diff
changeset
|
448 |
* |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
449 |
* The message is interpreted as a stream, for example: |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
450 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
451 |
* \code |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
452 |
* NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL (snr, 1128.93, 0.005, |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
453 |
* "wrong snr (" << snr << ") in test"); |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
454 |
* \endcode |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
455 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
456 |
* is legal. |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
457 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
458 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
459 |
* \param [in] limit Expression for the expected value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
460 |
* \param [in] tol Tolerance of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
461 |
* \param [in] msg Message that is output if the test does not pass. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
462 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
463 |
* This function returns a boolean value. |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
464 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
465 |
*/ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
466 |
#define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL(actual, limit, tol, msg) \ |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
467 |
NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__) |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
468 |
|
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
469 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
470 |
* \ingroup testingimpl |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
471 |
* \brief Test that actual and expected (limit) values are equal to |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
472 |
* plus or minus some tolerance and report if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
473 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
474 |
* Required to avoid use of return statement which allows use in |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
475 |
* methods (esp. callbacks) returning void. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
476 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
477 |
#define NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
478 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
479 |
if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
480 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
481 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
482 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
483 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
484 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
485 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
486 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
487 |
limitStream << limit << " +- " << tol; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
488 |
std::ostringstream condStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
489 |
condStream << #actual << " (actual) < " << #limit \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
490 |
<< " (limit) + " << #tol << " (tol) && " \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
491 |
<< #actual << " (actual) > " << #limit \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
492 |
<< " (limit) - " << #tol << " (tol)"; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
493 |
ReportTestFailure (condStream.str (), actualStream.str (), \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
494 |
limitStream.str (), msgStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
495 |
file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
496 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
497 |
} while (false) |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
498 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
499 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
500 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
501 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
502 |
* \brief Test that actual and expected (limit) values are equal to |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
503 |
* plus or minus some tolerance and report if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
504 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
505 |
* Check to see if the expected (limit) value is equal to the actual |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
506 |
* value found in a test case to some tolerance. This is not the same |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
507 |
* thing as asking if two floating point are equal to within some |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
508 |
* epsilon, but is useful for that case. This assertion is geared |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
509 |
* toward more of a measurement problem. Consider measuring a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
510 |
* physical rod of some kind that you have ordered. You need to |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
511 |
* determine if it is "good." You want to measure the rod to an |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
512 |
* arbitrary precision of sixteen significant figures, you will |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
513 |
* measure the rod to determine if its length is within the tolerances |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
514 |
* you provided. For example, 12.00 inches plus or minus .005 inch |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
515 |
* may be just fine. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
516 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
517 |
* In ns-3, you might want to measure a signal to noise ratio and |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
518 |
* check to see if the answer is what you expect. If you naively |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
519 |
* measure (double)1128.93 and compare this number with a constant |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
520 |
* 1128.93 you are almost certainly going to have your test fail |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
521 |
* because of floating point rounding errors. We provide a floating |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
522 |
* point comparison function ns3::TestDoubleIsEqual() but you will |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
523 |
* probably quickly find that is not what you want either. It may |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
524 |
* turn out to be the case that when you measured an snr that printed |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
525 |
* as 1128.93, what was actually measured was something more like |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
526 |
* 1128.9287653857625442 for example. Given that the double epsilon |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
527 |
* is on the order of 0.0000000000000009, you would need to provide |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
528 |
* sixteen significant figures of expected value for this kind of test |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
529 |
* to pass even with a typical test for floating point "approximate |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
530 |
* equality." That is clearly not required or desired. You really |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
531 |
* want to be able to provide 1128.93 along with a tolerance just like |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
532 |
* you provided 12 inches +- 0.005 inch above. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
533 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
534 |
* This assertion is designed for real measurements by taking into |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
535 |
* account measurement tolerances. By doing so it also automatically |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
536 |
* compensates for floating point rounding errors. If you really want |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
537 |
* to check floating point equality down to the |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
538 |
* numeric_limits<double>::epsilon () range, consider using |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
539 |
* ns3::TestDoubleIsEqual(). |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
540 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
541 |
* \note Mixing signed and unsigned types can lead to misleading |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
542 |
* results. |
10591
5770becb0bcb
Mixing signed and unsigned types can lead to misleading results in NS_TEST macros.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10587
diff
changeset
|
543 |
* |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
544 |
* The message is interpreted as a stream, for example: |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
545 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
546 |
* \code |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
547 |
* NS_TEST_EXPECT_MSG_EQ_TOL (snr, 1128.93, 0.005, |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
548 |
* "wrong snr (" << snr << ") in test"); |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
549 |
* \endcode |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
550 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
551 |
* is legal. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
552 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
553 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
554 |
* \param [in] limit Expression for the expected value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
555 |
* \param [in] tol Tolerance of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
556 |
* \param [in] msg Message that is output if the test does not pass. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
557 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
558 |
#define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg) \ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
559 |
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
560 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
561 |
// =========================================================================== |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
562 |
// Test for inequality |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
563 |
// =========================================================================== |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
564 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
565 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
566 |
* \ingroup testingimpl |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
567 |
* \brief Test that an actual and expected (limit) value are not equal and |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
568 |
* report and abort if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
569 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
570 |
#define NS_TEST_ASSERT_MSG_NE_INTERNAL(actual, limit, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
571 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
572 |
if (!((actual) != (limit))) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
573 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
574 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
575 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
576 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
577 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
578 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
579 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
580 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
581 |
ReportTestFailure (std::string (#actual) + " (actual) != " + \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
582 |
std::string (#limit) + " (limit)", \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
583 |
actualStream.str (), limitStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
584 |
msgStream.str (), file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
585 |
CONTINUE_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
586 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
587 |
} while (false) |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
588 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
589 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
590 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
591 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
592 |
* \brief Test that an actual and expected (limit) value are not equal |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
593 |
* and report and abort if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
594 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
595 |
* Check to see if the expected (limit) value is not equal to the |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
596 |
* actual value found in a test case. If the two values are not equal |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
597 |
* nothing happens, but if the comparison fails, an error is reported |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
598 |
* in a consistent way and the execution of the current test case is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
599 |
* aborted. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
600 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
601 |
* The message is interpreted as a stream, for example: |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
602 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
603 |
* \code |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
604 |
* NS_TEST_ASSERT_MSG_NE (result, false, |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
605 |
* "cannot open file " << filename << " in test"); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
606 |
* \endcode |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
607 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
608 |
* is legal. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
609 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
610 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
611 |
* \param [in] limit Expression for the value that actual is tested against. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
612 |
* \param [in] msg Message that is output if the test does not pass. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
613 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
614 |
* \warning Do not use this macro if you are comparing floating point |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
615 |
* numbers (float or double). Use NS_TEST_ASSERT_MSG_FLNE instead. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
616 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
617 |
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg) \ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
618 |
NS_TEST_ASSERT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
619 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
620 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
621 |
* \ingroup testingimpl |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
622 |
* \brief Test that an actual and expected (limit) value are not equal and |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
623 |
* report and abort if not. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
624 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
625 |
#define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
626 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
627 |
if (!((actual) != (limit))) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
628 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
629 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
630 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
631 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
632 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
633 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
634 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
635 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
636 |
ReportTestFailure (std::string (#actual) + " (actual) != " + \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
637 |
std::string (#limit) + " (limit)", \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
638 |
actualStream.str (), limitStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
639 |
msgStream.str (), file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
640 |
CONTINUE_ON_FAILURE_RETURNS_BOOL; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
641 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
642 |
} while (false) |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
643 |
|
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
644 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
645 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
646 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
647 |
* \brief Test that an actual and expected (limit) value are not equal |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
648 |
* and report and abort if not. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
649 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
650 |
* Check to see if the expected (limit) value is not equal to the |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
651 |
* actual value found in a test case. If the two values are equal |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
652 |
* nothing happens, but if the comparison fails, an error is reported |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
653 |
* in a consistent way and the execution of the current test case is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
654 |
* aborted. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
655 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
656 |
* The message is interpreted as a stream, for example: |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
657 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
658 |
* \code |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
659 |
* NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL (result, false, |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
660 |
* "cannot open file " << filename << " in test"); |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
661 |
* \endcode |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
662 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
663 |
* is legal. |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
664 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
665 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
666 |
* \param [in] limit Expression for the expected value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
667 |
* \param [in] msg Message that is output if the test does not pass. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
668 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
669 |
* \warning Do not use this macro if you are comparing floating point |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
670 |
* numbers (float or double). Use NS_TEST_ASSERT_MSG_FLNE instead. |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
671 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
672 |
* This function returns a boolean value. |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
673 |
* |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
674 |
*/ |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
675 |
#define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL(actual, limit, msg) \ |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
676 |
NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
677 |
|
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
678 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
679 |
* \ingroup testingimpl |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
680 |
* \brief Test that an actual and expected (limit) value are not equal and |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
681 |
* report if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
682 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
683 |
* Required to avoid use of return statement which allows use in methods |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
684 |
* (callbacks) returning void. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
685 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
686 |
#define NS_TEST_EXPECT_MSG_NE_INTERNAL(actual, limit, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
687 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
688 |
if (!((actual) != (limit))) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
689 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
690 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
691 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
692 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
693 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
694 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
695 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
696 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
697 |
ReportTestFailure (std::string (#actual) + " (actual) != " + \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
698 |
std::string (#limit) + " (limit)", \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
699 |
actualStream.str (), limitStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
700 |
msgStream.str (), file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
701 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
702 |
} while (false) |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
703 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
704 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
705 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
706 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
707 |
* \brief Test that an actual and expected (limit) value are not equal |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
708 |
* and report if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
709 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
710 |
* Check to see if the expected (limit) value is not equal to the |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
711 |
* actual value found in a test case. If the two values are not equal |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
712 |
* nothing happens, but if the comparison fails, an error is reported |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
713 |
* in a consistent way. EXPECT* macros do not return if an error is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
714 |
* detected. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
715 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
716 |
* The message is interpreted as a stream, for example: |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
717 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
718 |
* \code |
7685 | 719 |
* NS_TEST_EXPECT_MSG_NE (result, false, |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
720 |
* "cannot open file " << filename << " in test"); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
721 |
* \endcode |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
722 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
723 |
* is legal. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
724 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
725 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
726 |
* \param [in] limit Expression for the value that actual is tested against. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
727 |
* \param [in] msg Message that is output if the test does not pass. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
728 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
729 |
* \warning Do not use this macro if you are comparing floating point |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
730 |
* numbers (float or double). Use NS_TEST_EXPECT_MSG_FLNE instead. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
731 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
732 |
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg) \ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
733 |
NS_TEST_EXPECT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
734 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
735 |
// =========================================================================== |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
736 |
// Test for less than relation |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
737 |
// =========================================================================== |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
738 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
739 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
740 |
* \ingroup testingimpl |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
741 |
* \brief Test that an actual value is less than a limit and report and abort |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
742 |
* if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
743 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
744 |
#define NS_TEST_ASSERT_MSG_LT_INTERNAL(actual, limit, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
745 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
746 |
if (!((actual) < (limit))) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
747 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
748 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
749 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
750 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
751 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
752 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
753 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
754 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
755 |
ReportTestFailure (std::string (#actual) + " (actual) < " + \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
756 |
std::string (#limit) + " (limit)", \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
757 |
actualStream.str (), limitStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
758 |
msgStream.str (), file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
759 |
CONTINUE_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
760 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
761 |
} while (false) |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
762 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
763 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
764 |
* \ingroup testingimpl |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
765 |
* \brief Test that an actual value is less than or equal to a limit and report |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
766 |
* and abort if not. |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
767 |
*/ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
768 |
#define NS_TEST_ASSERT_MSG_LT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
769 |
do { \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
770 |
if (!((actual) <= (limit))) \ |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
771 |
{ \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
772 |
ASSERT_ON_FAILURE; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
773 |
std::ostringstream msgStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
774 |
msgStream << msg; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
775 |
std::ostringstream actualStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
776 |
actualStream << actual; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
777 |
std::ostringstream limitStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
778 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
779 |
ReportTestFailure (std::string (#actual) + " (actual) < " + \ |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
780 |
std::string (#limit) + " (limit)", \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
781 |
actualStream.str (), limitStream.str (), \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
782 |
msgStream.str (), file, line); \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
783 |
CONTINUE_ON_FAILURE; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
784 |
} \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
785 |
} while (false) |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
786 |
|
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
787 |
/** |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
788 |
* \ingroup testing |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
789 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
790 |
* \brief Test that an actual value is less than a limit and report |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
791 |
* and abort if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
792 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
793 |
* Check to see if the actual value found in a test case is less than |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
794 |
* the limit value. If the actual value is lesser nothing happens, |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
795 |
* but if the check fails, an error is reported in a consistent way |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
796 |
* and the execution of the current test case is aborted. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
797 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
798 |
* The message is interpreted as a stream. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
799 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
800 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
801 |
* \param [in] limit Expression for the limit value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
802 |
* \param [in] msg Message that is output if the test does not pass. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
803 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
804 |
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg) \ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
805 |
NS_TEST_ASSERT_MSG_LT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
806 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
807 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
808 |
* \ingroup testing |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
809 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
810 |
* \brief Test that an actual value is less than or equal to a limit |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
811 |
* and report and abort if not. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
812 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
813 |
* Check to see if the actual value found in a test case is less than |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
814 |
* or equal to the limit value. If the actual value is lesser or |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
815 |
* equal nothing happens, but if the check fails, an error is reported |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
816 |
* in a consistent way and the execution of the current test case is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
817 |
* aborted. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
818 |
* |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
819 |
* The message is interpreted as a stream. |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
820 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
821 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
822 |
* \param [in] limit Expression for the limit value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
823 |
* \param [in] msg Message that is output if the test does not pass. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
824 |
*/ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
825 |
#define NS_TEST_ASSERT_MSG_LT_OR_EQ(actual, limit, msg) \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
826 |
NS_TEST_ASSERT_MSG_LT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
827 |
|
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
828 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
829 |
* \ingroup testingimpl |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
830 |
* \brief Test that an actual value is less than a limit and report if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
831 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
832 |
* Required to avoid use of return statement which allows use in methods |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
833 |
* (callbacks) returning void. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
834 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
835 |
#define NS_TEST_EXPECT_MSG_LT_INTERNAL(actual, limit, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
836 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
837 |
if (!((actual) < (limit))) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
838 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
839 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
840 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
841 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
842 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
843 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
844 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
845 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
846 |
ReportTestFailure (std::string (#actual) + " (actual) < " + \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
847 |
std::string (#limit) + " (limit)", \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
848 |
actualStream.str (), limitStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
849 |
msgStream.str (), file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
850 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
851 |
} while (false) |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
852 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
853 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
854 |
* \ingroup testingimpl |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
855 |
* \brief Test that an actual value is less than or equal to a limit |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
856 |
* and report if not. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
857 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
858 |
* Required to avoid use of return statement which allows use in |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
859 |
* methods (callbacks) returning void. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
860 |
*/ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
861 |
#define NS_TEST_EXPECT_MSG_LT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
862 |
do { \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
863 |
if (!((actual) <= (limit))) \ |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
864 |
{ \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
865 |
ASSERT_ON_FAILURE; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
866 |
std::ostringstream msgStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
867 |
msgStream << msg; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
868 |
std::ostringstream actualStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
869 |
actualStream << actual; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
870 |
std::ostringstream limitStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
871 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
872 |
ReportTestFailure (std::string (#actual) + " (actual) < " + \ |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
873 |
std::string (#limit) + " (limit)", \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
874 |
actualStream.str (), limitStream.str (), \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
875 |
msgStream.str (), file, line); \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
876 |
} \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
877 |
} while (false) |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
878 |
|
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
879 |
/** |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
880 |
* \ingroup testing |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
881 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
882 |
* \brief Test that an actual value is less than a limit and report if |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
883 |
* not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
884 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
885 |
* Check to see if the actual value found in a test case is less than |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
886 |
* the limit value. If the actual value is lesser nothing happens, |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
887 |
* but if the check fails, an error is reported in a consistent way. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
888 |
* EXPECT* macros do not return if an error is detected. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
889 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
890 |
* The message is interpreted as a stream. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
891 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
892 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
893 |
* \param [in] limit Expression for the limit value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
894 |
* \param [in] msg Message that is output if the test does not pass. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
895 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
896 |
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg) \ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
897 |
NS_TEST_EXPECT_MSG_LT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
898 |
|
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
899 |
/** |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
900 |
* \ingroup testing |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
901 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
902 |
* \brief Test that an actual value is less than or equal to a limit |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
903 |
* and report if not. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
904 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
905 |
* Check to see if the actual value found in a test case is less than |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
906 |
* or equal to the limit value. If the actual value is lesser or |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
907 |
* equal nothing happens, but if the check fails, an error is reported |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
908 |
* in a consistent way. EXPECT* macros do not return if an error is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
909 |
* detected. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
910 |
* |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
911 |
* The message is interpreted as a stream. |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
912 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
913 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
914 |
* \param [in] limit Expression for the limit value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
915 |
* \param [in] msg Message that is output if the test does not pass. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
916 |
*/ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
917 |
#define NS_TEST_EXPECT_MSG_LT_OR_EQ(actual, limit, msg) \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
918 |
NS_TEST_EXPECT_MSG_LT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
919 |
|
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
920 |
// =========================================================================== |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
921 |
// Test for greater than relation |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
922 |
// =========================================================================== |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
923 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
924 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
925 |
* \ingroup testingimpl |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
926 |
* \brief Test that an actual value is greater than a limit and report and abort |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
927 |
* if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
928 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
929 |
#define NS_TEST_ASSERT_MSG_GT_INTERNAL(actual, limit, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
930 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
931 |
if (!((actual) > (limit))) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
932 |
{ \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
933 |
ASSERT_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
934 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
935 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
936 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
937 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
938 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
939 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
940 |
ReportTestFailure (std::string (#actual) + " (actual) > " + \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
941 |
std::string (#limit) + " (limit)", \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
942 |
actualStream.str (), limitStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
943 |
msgStream.str (), file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
944 |
CONTINUE_ON_FAILURE; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
945 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
946 |
} while (false) |
9
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
947 |
|
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
948 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
949 |
* \ingroup testingimpl |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
950 |
* \brief Test that an actual value is greater than or equal to a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
951 |
* limit and report and abort if not. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
952 |
*/ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
953 |
#define NS_TEST_ASSERT_MSG_GT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
954 |
do { \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
955 |
if (!((actual) >= (limit))) \ |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
956 |
{ \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
957 |
ASSERT_ON_FAILURE; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
958 |
std::ostringstream msgStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
959 |
msgStream << msg; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
960 |
std::ostringstream actualStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
961 |
actualStream << actual; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
962 |
std::ostringstream limitStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
963 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
964 |
ReportTestFailure (std::string (#actual) + " (actual) > " + \ |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
965 |
std::string (#limit) + " (limit)", \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
966 |
actualStream.str (), limitStream.str (), \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
967 |
msgStream.str (), file, line); \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
968 |
CONTINUE_ON_FAILURE; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
969 |
} \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
970 |
} while (false) |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
971 |
|
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
972 |
/** |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
973 |
* \ingroup testing |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
974 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
975 |
* \brief Test that an actual value is greater than a limit and report |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
976 |
* and abort if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
977 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
978 |
* Check to see if the actual value found in a test case is greater |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
979 |
* than the limit value. If the actual value is greater nothing |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
980 |
* happens, but if the check fails, an error is reported in a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
981 |
* consistent way and the execution of the current test case is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
982 |
* aborted. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
983 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
984 |
* The message is interpreted as a stream. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
985 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
986 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
987 |
* \param [in] limit Expression for the limit value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
988 |
* \param [in] msg Message that is output if the test does not pass. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
989 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
990 |
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg) \ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
991 |
NS_TEST_ASSERT_MSG_GT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
992 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
993 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
994 |
* \ingroup testing |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
995 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
996 |
* \brief Test that an actual value is greater than or equal to a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
997 |
* limit and report and abort if not. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
998 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
999 |
* Check to see if the actual value found in a test case is greater |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1000 |
* than or equal to the limit value. If the actual value is greater |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1001 |
* nothing happens, but if the check fails, an error is reported in a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1002 |
* consistent way and the execution of the current test case is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1003 |
* aborted. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1004 |
* |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1005 |
* The message is interpreted as a stream. |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1006 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1007 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1008 |
* \param [in] limit Expression for the limit value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1009 |
* \param [in] msg Message that is output if the test does not pass. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1010 |
*/ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1011 |
#define NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg) \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1012 |
NS_TEST_ASSERT_MSG_GT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1013 |
|
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1014 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
1015 |
* \ingroup testingimpl |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1016 |
* \brief Test that an actual value is greater than a limit and report if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1017 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1018 |
* Required to avoid use of return statement which allows use in methods |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1019 |
* (callbacks) returning void. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1020 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1021 |
#define NS_TEST_EXPECT_MSG_GT_INTERNAL(actual, limit, msg, file, line) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1022 |
do { \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1023 |
if (!((actual) > (limit))) \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1024 |
{ \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1025 |
ASSERT_ON_FAILURE; \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1026 |
std::ostringstream msgStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1027 |
msgStream << msg; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1028 |
std::ostringstream actualStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1029 |
actualStream << actual; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1030 |
std::ostringstream limitStream; \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1031 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1032 |
ReportTestFailure (std::string (#actual) + " (actual) > " + \ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1033 |
std::string (#limit) + " (limit)", \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1034 |
actualStream.str (), limitStream.str (), \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1035 |
msgStream.str (), file, line); \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1036 |
} \ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1037 |
} while (false) |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1038 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1039 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
1040 |
* \ingroup testingimpl |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1041 |
* \brief Test that an actual value is greater than or equal to limit |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1042 |
* and report if not. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1043 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1044 |
* Required to avoid use of return statement which allows use in |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1045 |
* methods (callbacks) returning void. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1046 |
*/ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1047 |
#define NS_TEST_EXPECT_MSG_GT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1048 |
do { \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1049 |
if (!((actual) >= (limit))) \ |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1050 |
{ \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1051 |
ASSERT_ON_FAILURE; \ |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1052 |
std::ostringstream msgStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1053 |
msgStream << msg; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1054 |
std::ostringstream actualStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1055 |
actualStream << actual; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1056 |
std::ostringstream limitStream; \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1057 |
limitStream << limit; \ |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1058 |
ReportTestFailure (std::string (#actual) + " (actual) > " + \ |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1059 |
std::string (#limit) + " (limit)", \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1060 |
actualStream.str (), limitStream.str (), \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1061 |
msgStream.str (), file, line); \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1062 |
} \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1063 |
} while (false) |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1064 |
|
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1065 |
/** |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1066 |
* \ingroup testing |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1067 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1068 |
* \brief Test that an actual value is greater than a limit and report |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1069 |
* if not. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1070 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1071 |
* Check to see if the actual value found in a test case is greater |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1072 |
* than the limit value. If the actual value is greater nothing |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1073 |
* happens, but if the check fails, an error is reported in a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1074 |
* consistent way. EXPECT* macros do not return if an error is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1075 |
* detected. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1076 |
* |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1077 |
* The message is interpreted as a stream. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1078 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1079 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1080 |
* \param [in] limit Expression for the limit value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1081 |
* \param [in] msg Message that is output if the test does not pass. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1082 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1083 |
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg) \ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1084 |
NS_TEST_EXPECT_MSG_GT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1085 |
|
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1086 |
/** |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1087 |
* \ingroup testing |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1088 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1089 |
* \brief Test that an actual value is greater than or equal to limit |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1090 |
* and report if not. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1091 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1092 |
* Check to see if the actual value found in a test case is greater |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1093 |
* than or equal to the limit value. If the actual value is greater |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1094 |
* nothing happens, but if the check fails, an error is reported in a |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1095 |
* consistent way. EXPECT* macros do not return if an error is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1096 |
* detected. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1097 |
* |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1098 |
* The message is interpreted as a stream. |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1099 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1100 |
* \param [in] actual Expression for the actual value found during the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1101 |
* \param [in] limit Expression for the limit value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1102 |
* \param [in] msg Message that is output if the test does not pass. |
10884
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1103 |
*/ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1104 |
#define NS_TEST_EXPECT_MSG_GT_OR_EQ(actual, limit, msg) \ |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1105 |
NS_TEST_EXPECT_MSG_GT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
78099d73b2f4
GT_OR_EQ and LT_OR_EQ macros for testing
Natale Patriciello <natale.patriciello@gmail.com>
parents:
10654
diff
changeset
|
1106 |
|
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1107 |
namespace ns3 { |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1108 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1109 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
1110 |
* \ingroup testing |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1111 |
* \brief Compare two double precision floating point numbers and |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1112 |
* declare them equal if they are within some epsilon of each other. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1113 |
* |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1114 |
* Approximate comparison of floating point numbers near equality is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1115 |
* trickier than one may expect and is well-discussed in the |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1116 |
* literature. Basic strategies revolve around a suggestion by Knuth |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1117 |
* to compare the floating point numbers as binary integers, supplying |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1118 |
* a maximum difference between them . This max difference is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1119 |
* specified in Units in the Last Place (ulps) or a floating point |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1120 |
* epsilon. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1121 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1122 |
* This routine is based on the GNU Scientific Library function |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1123 |
* gsl_fcmp. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1124 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1125 |
* \param [in] a The first of double precision floating point |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1126 |
* numbers to compare |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1127 |
* \param [in] b The second of double precision floating point |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1128 |
* numbers to compare |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1129 |
* \param [in] epsilon The tolerance to use in the comparison. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1130 |
* \returns Returns \c true if the doubles are equal to a precision |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1131 |
* defined by epsilon |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1132 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1133 |
bool TestDoubleIsEqual (const double a, const double b, |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1134 |
const double epsilon = std::numeric_limits<double>::epsilon ()); |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1135 |
|
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1136 |
class TestRunnerImpl; |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1137 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1138 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1139 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1140 |
* |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1141 |
* \brief encapsulates test code |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1142 |
* |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1143 |
* To allow a new test to be run within the ns-3 test framework, users |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1144 |
* need to create subclasses of this base class, override the DoRun |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1145 |
* method, and use the NS_TEST_* macros within DoRun. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1146 |
*/ |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1147 |
class TestCase : private NonCopyable |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1148 |
{ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1149 |
public: |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1150 |
/** \brief How long the test takes to execute. */ |
9265
0455e96a3cca
Allow three speeds of test cases to be skipped
Mitch Watrous <watrous@u.washington.edu>
parents:
9257
diff
changeset
|
1151 |
enum TestDuration { |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1152 |
QUICK = 1, //!< Fast test. |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1153 |
EXTENSIVE = 2, //!< Medium length test. |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1154 |
TAKES_FOREVER = 3 //!< Very long running test. |
9265
0455e96a3cca
Allow three speeds of test cases to be skipped
Mitch Watrous <watrous@u.washington.edu>
parents:
9257
diff
changeset
|
1155 |
}; |
0455e96a3cca
Allow three speeds of test cases to be skipped
Mitch Watrous <watrous@u.washington.edu>
parents:
9257
diff
changeset
|
1156 |
|
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1157 |
/** |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1158 |
* Destructor |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1159 |
*/ |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1160 |
virtual ~TestCase (); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1161 |
|
10587
804b073ef2fd
Enable tests to get the name of the parent suite.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9967
diff
changeset
|
1162 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1163 |
* \return The name of this test |
10587
804b073ef2fd
Enable tests to get the name of the parent suite.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9967
diff
changeset
|
1164 |
*/ |
804b073ef2fd
Enable tests to get the name of the parent suite.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9967
diff
changeset
|
1165 |
std::string GetName (void) const; |
804b073ef2fd
Enable tests to get the name of the parent suite.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9967
diff
changeset
|
1166 |
|
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1167 |
protected: |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1168 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1169 |
* \brief Constructor. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1170 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1171 |
* \param [in] name The name of the new TestCase created |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1172 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1173 |
TestCase (std::string name); |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1174 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1175 |
/** |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1176 |
* \brief Add an individual child TestCase to this test suite. |
9266
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9265
diff
changeset
|
1177 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1178 |
* \param [in] testCase Pointer to the TestCase object to be added. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1179 |
* \param [in] duration Amount of time this test takes to execute. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1180 |
*/ |
9266
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9265
diff
changeset
|
1181 |
void AddTestCase (TestCase *testCase, enum TestDuration duration); |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1182 |
|
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1183 |
/** |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1184 |
* \brief Set the data directory where reference trace files can be |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1185 |
* found. |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1186 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1187 |
* \param [in] directory The directory where the test data is |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1188 |
* located |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1189 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1190 |
* In general, this method is invoked as SetDataDir |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1191 |
* (NS_TEST_SOURCEDIR); However, if a module contains a test |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1192 |
* directory with subdirectories (e.g. src/mesh/test), and the test |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1193 |
* data (e.g. pcap traces) is located in one of these |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1194 |
* subdirectories, then the variable NS_TEST_SOURCEDIR may not work |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1195 |
* and the user may want to explicitly pass in a directory string. |
7409
ef4818bb81bc
bug 1232: NS_TEST_SOURCEDIR does not handle test subdirectories
Tom Henderson <tomh@tomh.org>
parents:
7379
diff
changeset
|
1196 |
* |
ef4818bb81bc
bug 1232: NS_TEST_SOURCEDIR does not handle test subdirectories
Tom Henderson <tomh@tomh.org>
parents:
7379
diff
changeset
|
1197 |
* Note that NS_TEST_SOURCEDIR is set in src/wscript for each module |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1198 |
*/ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1199 |
void SetDataDir (std::string directory); |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1200 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1201 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1202 |
* \brief Check if any tests failed. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1203 |
* |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1204 |
* \return \c true if any of the tests have failed, \c false otherwise. |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1205 |
*/ |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1206 |
bool IsStatusFailure (void) const; |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1207 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1208 |
* \brief Check if all tests passed. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1209 |
* |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1210 |
* \return \c true if the tests have succeeded, \c false otherwise. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1211 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1212 |
bool IsStatusSuccess (void) const; |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1213 |
|
8920
518fce9abcf9
Bug 1476: TestCase::GetName () should not be private
Mitch Watrous <watrous@u.washington.edu>
parents:
7745
diff
changeset
|
1214 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1215 |
* \brief Get the parent of this TestCsse. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1216 |
* |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1217 |
* \return A pointer to the parent of this test. |
8920
518fce9abcf9
Bug 1476: TestCase::GetName () should not be private
Mitch Watrous <watrous@u.washington.edu>
parents:
7745
diff
changeset
|
1218 |
*/ |
10587
804b073ef2fd
Enable tests to get the name of the parent suite.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9967
diff
changeset
|
1219 |
TestCase * GetParent () const; |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1220 |
|
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1221 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1222 |
* \name Internal Interface |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1223 |
* These methods are the interface used by test macros and should not |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1224 |
* be used directly by normal test code. |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1225 |
* @{ |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1226 |
*/ |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1227 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1228 |
* \brief Log the failure of this TestCase. |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
1229 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1230 |
* \param [in] cond The test condition. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1231 |
* \param [in] actual Actual value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1232 |
* \param [in] limit Expected value of the test. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1233 |
* \param [in] message Message indicating the type of failure. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1234 |
* \param [in] file The file where the test failed. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1235 |
* \param [in] line The line number in \p file where the test failed. |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1236 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1237 |
void ReportTestFailure (std::string cond, std::string actual, |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1238 |
std::string limit, std::string message, |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1239 |
std::string file, int32_t line); |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1240 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1241 |
* \brief Check if this run should assert on failure. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1242 |
* |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1243 |
* \return \c true if we should assert on failure. |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1244 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1245 |
bool MustAssertOnFailure (void) const; |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1246 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1247 |
* \brief Check if this run should continue on failure. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1248 |
* |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1249 |
* \return \c true if we should continue on failure. |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1250 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1251 |
bool MustContinueOnFailure (void) const; |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1252 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1253 |
* \brief Construct the full path to a file in the data directory. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1254 |
* |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1255 |
* The data directory is configured by SetDataDirectory(). |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1256 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1257 |
* \param [in] filename The bare (no path) file name |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1258 |
* \return The full path to \p filename in the data directory |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1259 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1260 |
std::string CreateDataDirFilename (std::string filename); |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1261 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1262 |
* \brief Construct the full path to a file in a temporary directory. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1263 |
* |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1264 |
* If the TestRunner is invoked with "--update-data", this will be |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1265 |
* the data directory instead. |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1266 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1267 |
* \param [in] filename The bare (no path) file name |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1268 |
* \return The full path to \p filename in the temporary directory. |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1269 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1270 |
std::string CreateTempDirFilename (std::string filename); |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1271 |
/**@}*/ |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1272 |
|
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1273 |
private: |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1274 |
friend class TestRunnerImpl; |
5324
0ba73cdd2a43
Refalgamize test framework to allow multiple test failures
Craig Dowell <craigdo@ee.washington.edu>
parents:
5239
diff
changeset
|
1275 |
|
0ba73cdd2a43
Refalgamize test framework to allow multiple test failures
Craig Dowell <craigdo@ee.washington.edu>
parents:
5239
diff
changeset
|
1276 |
/** |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1277 |
* \brief Implementation to do any local setup required for this |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1278 |
* TestCase. |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1279 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1280 |
* Subclasses should override this method to perform any costly |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1281 |
* per-test setup before DoRun is invoked. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1282 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1283 |
virtual void DoSetup (void); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1284 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1285 |
/** |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1286 |
* \brief Implementation to actually run this TestCase. |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1287 |
* |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1288 |
* Subclasses should override this method to conduct their tests. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1289 |
*/ |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
1290 |
virtual void DoRun (void) = 0; |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1291 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1292 |
/** |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1293 |
* \brief Implementation to do any local setup required for this |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1294 |
* TestCase. |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1295 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1296 |
* Subclasses should override this method to perform any costly |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1297 |
* per-test teardown |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1298 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1299 |
virtual void DoTeardown (void); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1300 |
|
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1301 |
// methods called by TestRunnerImpl |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1302 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1303 |
* \brief Actually run this TestCase |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1304 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1305 |
* \param [in] runner The test runner implementation. |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1306 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1307 |
void Run (TestRunnerImpl *runner); |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1308 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1309 |
* \copydoc IsStatusFailure() |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1310 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1311 |
bool IsFailed (void) const; |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1312 |
|
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1313 |
/** |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1314 |
* \ingroup testingimpl |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1315 |
* \brief Container for results from a TestCase. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1316 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1317 |
struct Result; |
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1318 |
|
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1319 |
TestCase *m_parent; //!< Pointer to my parent TestCase |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1320 |
std::vector<TestCase *> m_children; //!< Vector of my children |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1321 |
std::string m_dataDir; //!< My data directory |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1322 |
TestRunnerImpl *m_runner; //!< Pointer to the TestRunner |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1323 |
struct Result *m_result; //!< Results data |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1324 |
std::string m_name; //!< TestCase name |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1325 |
enum TestDuration m_duration; //!< TestCase duration |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1326 |
}; |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1327 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1328 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1329 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1330 |
* |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1331 |
* \brief A suite of tests to run. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1332 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1333 |
class TestSuite : public TestCase |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1334 |
{ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1335 |
public: |
5225
9c612cb88d6b
Doxygenize.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5185
diff
changeset
|
1336 |
/** |
7600
57ba46094a0d
fix various doxygen errors
Vedran Miletić <rivanvx@gmail.com>
parents:
7409
diff
changeset
|
1337 |
* \enum Type |
5225
9c612cb88d6b
Doxygenize.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5185
diff
changeset
|
1338 |
* \brief Type of test. |
9c612cb88d6b
Doxygenize.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5185
diff
changeset
|
1339 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1340 |
enum Type { |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1341 |
ALL = 0, //!< |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1342 |
BVT = 1, //!< This test suite implements a Build Verification Test |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1343 |
UNIT, //!< This test suite implements a Unit Test |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1344 |
SYSTEM, //!< This test suite implements a System Test |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1345 |
EXAMPLE, //!< This test suite implements an Example Test |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1346 |
PERFORMANCE //!< This test suite implements a Performance Test |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1347 |
}; |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1348 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1349 |
/** |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1350 |
* \brief Constuct a new test suite. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1351 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1352 |
* \param [in] name The name of the test suite. |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1353 |
* \param [in] type The TestType of the test suite (defaults to UNIT test). |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1354 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1355 |
TestSuite (std::string name, Type type = UNIT); |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1356 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1357 |
/** |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1358 |
* \brief get the kind of test this test suite implements |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1359 |
* |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1360 |
* \returns The Type of the suite. |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1361 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1362 |
TestSuite::Type GetTestType (void); |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1363 |
|
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1364 |
private: |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1365 |
// Inherited |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6620
diff
changeset
|
1366 |
virtual void DoRun (void); |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1367 |
|
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1368 |
TestSuite::Type m_type; //!< Type of this TestSuite |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1369 |
}; |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1370 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1371 |
/** |
11046
e62bccfbe56e
[Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11045
diff
changeset
|
1372 |
* \ingroup testingimpl |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1373 |
* |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1374 |
* \brief A runner to execute tests. |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1375 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1376 |
class TestRunner |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1377 |
{ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1378 |
public: |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1379 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1380 |
* Run the requested suite of tests, |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1381 |
* according to the given command line arguments. |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1382 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1383 |
* \param [in] argc The number of elements in \pname{argv} |
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1384 |
* \param [in] argv The vector of command line arguments |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1385 |
* \returns Success status |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1386 |
*/ |
7379
ff0d074f885a
add support for --update-data to test.py, move test runner code to library for modular build, add support for hierarchical tests beyond the previous two-level hierarchy.
Mathieu Lacage <mathieu.lacage@gmail.com>
parents:
7252
diff
changeset
|
1387 |
static int Run (int argc, char *argv[]); |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1388 |
}; |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1389 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1390 |
/** |
10654
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1391 |
* \ingroup testing |
0148f9c47331
[doxygen] Make introspected lists more visible, various other doxy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10591
diff
changeset
|
1392 |
* |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1393 |
* \brief A simple way to store test vectors (for stimulus or from responses) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1394 |
*/ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1395 |
template <typename T> |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1396 |
class TestVectors : private NonCopyable |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1397 |
{ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1398 |
public: |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1399 |
/** |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1400 |
* Constructor |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1401 |
*/ |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1402 |
TestVectors (); |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1403 |
/** |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1404 |
* Virtual desctructor |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1405 |
*/ |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1406 |
virtual ~TestVectors (); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1407 |
|
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1408 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1409 |
* \brief Set the expected length of this vector. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1410 |
* |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1411 |
* \param [in] reserve The number of entries to reserve |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1412 |
*/ |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1413 |
void Reserve (uint32_t reserve); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1414 |
|
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1415 |
/** |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1416 |
* \param [in] vector The test vector to add |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1417 |
* |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1418 |
* \returns The new test vector index |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1419 |
*/ |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1420 |
uint32_t Add (T vector); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1421 |
|
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1422 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1423 |
* \brief Get the total number of test vectors. |
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1424 |
* \return The number of test vectors |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1425 |
*/ |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1426 |
uint32_t GetN (void) const; |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1427 |
/** |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1428 |
* \brief Get the i'th test vector |
11538
397bd6465dd9
[Doxygen] Label arguments as in,out. Sentence capitalization.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11531
diff
changeset
|
1429 |
* \param [in] i The requested vector index |
11531
5d6b3f94ebf3
[Doxygen] Remaining in core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11356
diff
changeset
|
1430 |
* \return The requested vector |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1431 |
*/ |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1432 |
T Get (uint32_t i) const; |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1433 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1434 |
private: |
9967
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1435 |
typedef std::vector<T> TestVector; //!< Container type |
ee6722b8afaa
[Doxygen] use \internal
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9871
diff
changeset
|
1436 |
TestVector m_vectors; //!< The list of test vectors |
4772
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1437 |
}; |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1438 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1439 |
template <typename T> |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1440 |
TestVectors<T>::TestVectors () |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1441 |
: m_vectors () |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1442 |
{ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1443 |
} |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1444 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1445 |
template <typename T> |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1446 |
void |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1447 |
TestVectors<T>::Reserve (uint32_t reserve) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1448 |
{ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1449 |
m_vectors.reserve (reserve); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1450 |
} |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1451 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1452 |
template <typename T> |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1453 |
TestVectors<T>::~TestVectors () |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1454 |
{ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1455 |
} |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1456 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1457 |
template <typename T> |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1458 |
uint32_t |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1459 |
TestVectors<T>::Add (T vector) |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1460 |
{ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1461 |
uint32_t index = m_vectors.size (); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1462 |
m_vectors.push_back (vector); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1463 |
return index; |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1464 |
} |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1465 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1466 |
template <typename T> |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1467 |
uint32_t |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1468 |
TestVectors<T>::GetN (void) const |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1469 |
{ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1470 |
return m_vectors.size (); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1471 |
} |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1472 |
|
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1473 |
template <typename T> |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1474 |
T |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1475 |
TestVectors<T>::Get (uint32_t i) const |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1476 |
{ |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1477 |
NS_ABORT_MSG_UNLESS (m_vectors.size () > i, "TestVectors::Get(): Bad index"); |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1478 |
return m_vectors[i]; |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1479 |
} |
7b6ae6bf0055
add test and validation framework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4678
diff
changeset
|
1480 |
|
5342
3c6109eec550
bug 675: kill old test framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5324
diff
changeset
|
1481 |
} // namespace ns3 |
9
2c31ae7c94db
import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1482 |
|
5342
3c6109eec550
bug 675: kill old test framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5324
diff
changeset
|
1483 |
#endif /* NS3_TEST_H */ |