|
Packit |
ea1746 |
// Copyright 2008, Google Inc.
|
|
Packit |
ea1746 |
// All rights reserved.
|
|
Packit |
ea1746 |
//
|
|
Packit |
ea1746 |
// Redistribution and use in source and binary forms, with or without
|
|
Packit |
ea1746 |
// modification, are permitted provided that the following conditions are
|
|
Packit |
ea1746 |
// met:
|
|
Packit |
ea1746 |
//
|
|
Packit |
ea1746 |
// * Redistributions of source code must retain the above copyright
|
|
Packit |
ea1746 |
// notice, this list of conditions and the following disclaimer.
|
|
Packit |
ea1746 |
// * Redistributions in binary form must reproduce the above
|
|
Packit |
ea1746 |
// copyright notice, this list of conditions and the following disclaimer
|
|
Packit |
ea1746 |
// in the documentation and/or other materials provided with the
|
|
Packit |
ea1746 |
// distribution.
|
|
Packit |
ea1746 |
// * Neither the name of Google Inc. nor the names of its
|
|
Packit |
ea1746 |
// contributors may be used to endorse or promote products derived from
|
|
Packit |
ea1746 |
// this software without specific prior written permission.
|
|
Packit |
ea1746 |
//
|
|
Packit |
ea1746 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit |
ea1746 |
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit |
ea1746 |
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit |
ea1746 |
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
Packit |
ea1746 |
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
Packit |
ea1746 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit |
ea1746 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit |
ea1746 |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit |
ea1746 |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit |
ea1746 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
ea1746 |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
ea1746 |
//
|
|
Packit |
ea1746 |
// Author: wan@google.com (Zhanyong Wan)
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
#include <iostream>
|
|
Packit |
ea1746 |
#include "gflags/gflags.h"
|
|
Packit |
ea1746 |
#include "glog/logging.h"
|
|
Packit |
ea1746 |
#include "gmock/gmock.h"
|
|
Packit |
ea1746 |
#include "gtest/gtest.h"
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
// NOTE(keir): This flag is normally part of gtest within Google but isn't in
|
|
Packit |
ea1746 |
// the open source Google Test, since it is build-system dependent. However for
|
|
Packit |
ea1746 |
// Ceres this is needed for our tests. Add the new flag here.
|
|
Packit |
ea1746 |
DEFINE_string(test_srcdir, "", "The location of the source code.");
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
|
|
Packit |
ea1746 |
// causes a link error when _tmain is defined in a static library and UNICODE
|
|
Packit |
ea1746 |
// is enabled. For this reason instead of _tmain, main function is used on
|
|
Packit |
ea1746 |
// Windows. See the following link to track the current status of this bug:
|
|
Packit |
ea1746 |
// http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=394464 // NOLINT
|
|
Packit |
ea1746 |
#if GTEST_OS_WINDOWS_MOBILE
|
|
Packit |
ea1746 |
# include <tchar.h> // NOLINT
|
|
Packit |
ea1746 |
|
|
Packit |
ea1746 |
GTEST_API_ int _tmain(int argc, TCHAR** argv) {
|
|
Packit |
ea1746 |
#else
|
|
Packit |
ea1746 |
GTEST_API_ int main(int argc, char** argv) {
|
|
Packit |
ea1746 |
#endif // GTEST_OS_WINDOWS_MOBILE
|
|
Packit |
ea1746 |
std::cout << "Running main() from gmock_main.cc\n";
|
|
Packit |
ea1746 |
google::InitGoogleLogging(argv[0]);
|
|
Packit |
ea1746 |
// Since Google Mock depends on Google Test, InitGoogleMock() is
|
|
Packit |
ea1746 |
// also responsible for initializing Google Test. Therefore there's
|
|
Packit |
ea1746 |
// no need for calling testing::InitGoogleTest() separately.
|
|
Packit |
ea1746 |
testing::InitGoogleMock(&argc, argv);
|
|
Packit |
ea1746 |
// On Windows, gtest passes additional non-gflags command line flags to
|
|
Packit |
ea1746 |
// death-tests, specifically --gtest_filter & --gtest_internal_run_death_test
|
|
Packit |
ea1746 |
// in order that these unknown (to gflags) flags do not invoke an error in
|
|
Packit |
ea1746 |
// gflags, InitGoogleTest() (called by InitGoogleMock()) must be called
|
|
Packit |
ea1746 |
// before ParseCommandLineFlags() to handle & remove them before gflags
|
|
Packit |
ea1746 |
// parses the remaining flags.
|
|
Packit |
ea1746 |
CERES_GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
|
|
Packit |
ea1746 |
return RUN_ALL_TESTS();
|
|
Packit |
ea1746 |
}
|