xref: /freebsd/contrib/googletest/docs/samples.md (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1# Googletest Samples
2
3If you're like us, you'd like to look at
4[googletest samples.](https://github.com/google/googletest/blob/main/googletest/samples)
5The sample directory has a number of well-commented samples showing how to use a
6variety of googletest features.
7
8*   Sample #1 shows the basic steps of using googletest to test C++ functions.
9*   Sample #2 shows a more complex unit test for a class with multiple member
10    functions.
11*   Sample #3 uses a test fixture.
12*   Sample #4 teaches you how to use googletest and `googletest.h` together to
13    get the best of both libraries.
14*   Sample #5 puts shared testing logic in a base test fixture, and reuses it in
15    derived fixtures.
16*   Sample #6 demonstrates type-parameterized tests.
17*   Sample #7 teaches the basics of value-parameterized tests.
18*   Sample #8 shows using `Combine()` in value-parameterized tests.
19*   Sample #9 shows use of the listener API to modify Google Test's console
20    output and the use of its reflection API to inspect test results.
21*   Sample #10 shows use of the listener API to implement a primitive memory
22    leak checker.
23