Skip to content

Commit 19e4c22

Browse files
committed
Add new section on correctness, mutation testing
1 parent 47e65a5 commit 19e4c22

9 files changed

+49
-6
lines changed

Diff for: 00-Table_of_Contents.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
6. [Considering Portability](06-Considering_Portability.md)
88
7. [Considering Threadability](07-Considering_Threadability.md)
99
8. [Considering Performance](08-Considering_Performance.md)
10-
9. [Enable Scripting](09-Enable_Scripting.md)
11-
10. [Further Reading](10-Further_Reading.md)
12-
11. [Final Thoughts](11-Final_Thoughts.md)
10+
9. [Considering Correctness](09-Considering_Correctness.md)
11+
10. [Enable Scripting](10-Enable_Scripting.md)
12+
11. [Further Reading](11-Further_Reading.md)
13+
12. [Final Thoughts](12-Final_Thoughts.md)
1314

1415

Diff for: 02-Use_the_Tools_Available.md

+9
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,15 @@ Both of these tools use coverage reporting to find new code execution paths and
303303
* [LibFuzzer](http://llvm.org/docs/LibFuzzer.html)
304304
* [KLEE](http://klee.github.io/) - Can be used to fuzz individual functions
305305

306+
### Mutation Testers
307+
308+
These tools take code executed during unit test runs and mutate the executed code. If the test continues to pass with a mutation in place, then there is likely a flawed test in your suite.
309+
310+
* [Dextool Mutate](https://github.com/joakim-brannstrom/dextool/tree/master/plugin/mutate)
311+
* [MuCPP](https://neptuno.uca.es/redmine/projects/mucpp-mutation-tool/wiki)
312+
* [mull](https://github.com/mull-project/mull)
313+
* [CCMutator](https://github.com/markus-kusano/CCMutator)
314+
306315
### Control Flow Guard
307316

308317
MSVC's [Control Flow Guard](https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396) adds high performance runtime security checks.

Diff for: 08-Considering_Performance.md

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ template<typename T> class MyTemplatedType;
3333

3434
This is a proactive approach to reduce compilation time and rebuilding dependencies.
3535

36+
*Note: forward declaration does prevent more inlining and optimizations. It's recommended to use Link Time Optimization or Link Time Code Generation for release builds.*
37+
3638
### Avoid Unnecessary Template Instantiations
3739

3840
Templates are not free to instantiate. Instantiating many templates, or templates with more code than necessary increases compiled code size and build time.

Diff for: 09-Considering_Correctness.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Considering Correctness
2+
3+
## Avoid Typeless Interfaces
4+
5+
6+
Bad Idea:
7+
8+
```cpp
9+
std::string find_file(const std::string &base, const std::string &pattern);
10+
```
11+
12+
Better Idea:
13+
14+
```cpp
15+
std::filesystem::path find_file(const std::filesystem::path &base, const std::regex &pattern);
16+
```
17+
18+
The above is better but still suffers from having implicit conversions from `std::string` to `std::filesystem::path` and back.
19+
20+
Consider using a typesafe library like
21+
22+
* https://foonathan.net/type_safe/
23+
* https://github.com/rollbear/strong_type
24+
25+
Note that stronger typing can also allow for more compiler optimizations.
26+
27+
28+
* [Sorting in C vs C++](Sorting in C vs C++.pdf)
29+
30+
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: SUMMARY.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
* [Considering Portability](06-Considering_Portability.md)
99
* [Considering Threadability](07-Considering_Threadability.md)
1010
* [Considering Performance](08-Considering_Performance.md)
11-
* [Enable Scripting](09-Enable_Scripting.md)
12-
* [Further Reading](10-Further_Reading.md)
13-
* [Final Thoughts](11-Final_Thoughts.md)
11+
* [Considering Correctness](09-Considering_Performance.md)
12+
* [Enable Scripting](10-Enable_Scripting.md)
13+
* [Further Reading](11-Further_Reading.md)
14+
* [Final Thoughts](12-Final_Thoughts.md)
1415

File renamed without changes.

0 commit comments

Comments
 (0)