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