You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cpp/ql/test/README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ The tests can be run through Visual Studio Code. Advanced users may also use th
8
8
9
9
We are keen to have unit tests for all of our QL code.
10
10
11
-
Every query in `cpp/ql/src` (outside of `cpp/ql/src/experimental`) should have a test in the corresponding subdirectory of `cpp/ql/test/query-tests`. At a minimum, each query test shall contain one case that should be detected by the query, and one related case that should not.
11
+
Every query in `cpp/ql/src` (outside of `cpp/ql/src/experimental`) should have a test in the corresponding subdirectory of `cpp/ql/test/query-tests`. At a minimum, each query test should contain one case that should be detected by the query, and one related case that should not.
12
12
13
13
For example a simple test for the "Memory is never freed" (`cpp/memory-never-freed`) query might contain the following cases:
14
14
```
@@ -24,14 +24,14 @@ Features of the QL libraries in `cpp/ql/src` should also have test coverage, in
24
24
25
25
## Copying code
26
26
27
-
The contents of `cpp/ql/test` should be original - nothing should be copied from other sources. In particular do not copy-paste C/C++ code from thirdparty projects, your own projects, or the standard C/C++ library implementation of your compiler (regardless of the associated license). As an exception, required declarations may be taken from the following sources where necessary:
27
+
The contents of `cpp/ql/test` should be original - nothing should be copied from other sources. In particular do not copy-paste C/C++ code from third-party projects, your own projects, or the standard C/C++ library implementation of your compiler (regardless of the associated license). As an exception, required declarations may be taken from the following sources where necessary:
28
28
- ISO/IEC Programming languages - C (all versions)
29
29
- ISO/IEC Programming languages - C++ (all versions)
30
-
-code from existing queries and tests in this repository
31
-
- this includes 'translating QL to C++', that is, writing C/C++ declarations from the information such as parameter names and positions specified in QL classes (when there is enough information to do so).
32
-
-code in the public domain
30
+
-Code from existing queries and tests in this repository
31
+
This includes 'translating QL to C++', that is, writing C/C++ declarations from the information such as parameter names and positions specified in QL classes (when there is enough information to do so).
32
+
-Code in the public domain
33
33
34
-
For example the test above for the "Memory is never freed" (`cpp/memory-never-freed`) query requires the following declarations, taken from Programming languages — C (November 2018):
34
+
For example the test above for the "Memory is never freed" (`cpp/memory-never-freed`) query requires the following declarations, taken from [ISO/IEC 9899:2018 - Programming languages - C](https://www.iso.org/standard/74528.html):
35
35
```
36
36
void *malloc(size_t size);
37
37
void free(void *ptr);
@@ -43,7 +43,7 @@ typedef unsigned int size_t;
43
43
44
44
## Including files
45
45
46
-
Standard and thirdparty library header files should not be included in tests by means of `#include` or similar mechanisms. This is because the tests should be independent of platform and library versions installed on the running machine. Standard library declarations may be inserted directly where necessary (see the rules in the section above), but it is generally better to avoid using the standard library at all when possible.
46
+
Standard and third-party library header files should not be included in tests by means of `#include` or similar mechanisms. This is because the tests should be independent of platform and library versions installed on the running machine. Standard library declarations may be inserted directly where necessary (see the rules in the section above), but it is generally better to avoid using the standard library at all when possible.
47
47
48
48
`#include` may be used to include files from the same directory within `cpp/ql/test`. For example the test for "Include header files only" (`cpp/include-non-header`) includes other files in the test directory:
0 commit comments