gtest_list_tests_unittest_.cc revision 41d0579e8de9ef4ff178fc4991043c61a19943f7
11be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Copyright 2006, Google Inc.
21be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// All rights reserved.
31be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania//
41be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Redistribution and use in source and binary forms, with or without
51be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// modification, are permitted provided that the following conditions are
61be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// met:
71be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania//
81be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania//     * Redistributions of source code must retain the above copyright
91be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// notice, this list of conditions and the following disclaimer.
101be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania//     * Redistributions in binary form must reproduce the above
111be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// copyright notice, this list of conditions and the following disclaimer
121be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// in the documentation and/or other materials provided with the
131be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// distribution.
141be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania//     * Neither the name of Google Inc. nor the names of its
151be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// contributors may be used to endorse or promote products derived from
161be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// this software without specific prior written permission.
171be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania//
181be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
191be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
201be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
211be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
221be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
231be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
241be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
251be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
261be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
271be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
281be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
291be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania//
301be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Author: phanna@google.com (Patrick Hanna)
311be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
321be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Unit test for Google Test's --gtest_list_tests flag.
331be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania//
341be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// A user can ask Google Test to list all tests that will run
351be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// so that when using a filter, a user will know what
361be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// tests to look for. The tests will not be run after listing.
371be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania//
381be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// This program will be invoked from a Python unit test.
391be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Don't run it directly.
401be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
4141d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot#include "gtest/gtest.h"
421be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
431be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catanianamespace {
441be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
451be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Several different test cases and tests that will be listed.
461be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTEST(Foo, Bar1) {
471be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
481be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
491be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTEST(Foo, Bar2) {
501be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
511be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
5241d0579e8de9ef4ff178fc4991043c61a19943f7Brett ChabotTEST(Foo, DISABLED_Bar3) {
531be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
541be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
551be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTEST(Abc, Xyz) {
561be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
571be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
581be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTEST(Abc, Def) {
591be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
601be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
611be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTEST(FooBar, Baz) {
621be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
631be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
641be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass FooTest : public testing::Test {
651be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania};
661be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
671be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTEST_F(FooTest, Test1) {
681be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
691be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
7041d0579e8de9ef4ff178fc4991043c61a19943f7Brett ChabotTEST_F(FooTest, DISABLED_Test2) {
711be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
721be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
731be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTEST_F(FooTest, Test3) {
741be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
751be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
761be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTEST(FooDeathTest, Test1) {
771be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
781be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
791be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}  // namespace
801be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
811be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaint main(int argc, char **argv) {
8241d0579e8de9ef4ff178fc4991043c61a19943f7Brett Chabot  ::testing::InitGoogleTest(&argc, argv);
831be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania
841be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania  return RUN_ALL_TESTS();
851be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}
86