Skip to content
Browse files

Add new section on correctness, mutation testing

  • Loading branch information
lefticus committed Dec 8, 2019
1 parent 47e65a5 commit 19e4c22de1aef040fa133e630d3a9b1257f8280a
@@ -7,8 +7,9 @@
6. [Considering Portability](
7. [Considering Threadability](
8. [Considering Performance](
9. [Enable Scripting](
10. [Further Reading](
11. [Final Thoughts](
9. [Considering Correctness](
10. [Enable Scripting](
11. [Further Reading](
12. [Final Thoughts](

@@ -303,6 +303,15 @@ Both of these tools use coverage reporting to find new code execution paths and
* [LibFuzzer](
* [KLEE]( - Can be used to fuzz individual functions

### Mutation Testers

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.

* [Dextool Mutate](
* [MuCPP](
* [mull](
* [CCMutator](

### Control Flow Guard

MSVC's [Control Flow Guard]( adds high performance runtime security checks.
@@ -33,6 +33,8 @@ template<typename T> class MyTemplatedType;

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

*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.*

### Avoid Unnecessary Template Instantiations

Templates are not free to instantiate. Instantiating many templates, or templates with more code than necessary increases compiled code size and build time.
@@ -0,0 +1,30 @@
# Considering Correctness

## Avoid Typeless Interfaces

Bad Idea:

std::string find_file(const std::string &base, const std::string &pattern);

Better Idea:

std::filesystem::path find_file(const std::filesystem::path &base, const std::regex &pattern);

The above is better but still suffers from having implicit conversions from `std::string` to `std::filesystem::path` and back.

Consider using a typesafe library like


Note that stronger typing can also allow for more compiler optimizations.

* [Sorting in C vs C++](Sorting in C vs C++.pdf)

File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -8,7 +8,8 @@
* [Considering Portability](
* [Considering Threadability](
* [Considering Performance](
* [Enable Scripting](
* [Further Reading](
* [Final Thoughts](
* [Considering Correctness](
* [Enable Scripting](
* [Further Reading](
* [Final Thoughts](

File renamed without changes.

0 comments on commit 19e4c22

Please sign in to comment.
You can’t perform that action at this time.