gmock-generated-internal-utils_test.cc
Go to the documentation of this file.
00001 // Copyright 2007, Google Inc.
00002 // All rights reserved.
00003 //
00004 // Redistribution and use in source and binary forms, with or without
00005 // modification, are permitted provided that the following conditions are
00006 // met:
00007 //
00008 //     * Redistributions of source code must retain the above copyright
00009 // notice, this list of conditions and the following disclaimer.
00010 //     * Redistributions in binary form must reproduce the above
00011 // copyright notice, this list of conditions and the following disclaimer
00012 // in the documentation and/or other materials provided with the
00013 // distribution.
00014 //     * Neither the name of Google Inc. nor the names of its
00015 // contributors may be used to endorse or promote products derived from
00016 // this software without specific prior written permission.
00017 //
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00019 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00020 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00021 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00022 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00023 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00024 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00025 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00026 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00028 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // Author: wan@google.com (Zhanyong Wan)
00031 
00032 // Google Mock - a framework for writing C++ mock classes.
00033 //
00034 // This file tests the internal utilities.
00035 
00036 #include "gmock/internal/gmock-generated-internal-utils.h"
00037 #include "gmock/internal/gmock-internal-utils.h"
00038 #include "gtest/gtest.h"
00039 
00040 namespace {
00041 
00042 using ::std::tr1::tuple;
00043 using ::testing::Matcher;
00044 using ::testing::internal::CompileAssertTypesEqual;
00045 using ::testing::internal::MatcherTuple;
00046 using ::testing::internal::Function;
00047 using ::testing::internal::IgnoredValue;
00048 
00049 // Tests the MatcherTuple template struct.
00050 
00051 TEST(MatcherTupleTest, ForSize0) {
00052   CompileAssertTypesEqual<tuple<>, MatcherTuple<tuple<> >::type>();
00053 }
00054 
00055 TEST(MatcherTupleTest, ForSize1) {
00056   CompileAssertTypesEqual<tuple<Matcher<int> >,
00057                           MatcherTuple<tuple<int> >::type>();
00058 }
00059 
00060 TEST(MatcherTupleTest, ForSize2) {
00061   CompileAssertTypesEqual<tuple<Matcher<int>, Matcher<char> >,
00062                           MatcherTuple<tuple<int, char> >::type>();
00063 }
00064 
00065 TEST(MatcherTupleTest, ForSize5) {
00066   CompileAssertTypesEqual<tuple<Matcher<int>, Matcher<char>, Matcher<bool>,
00067                                 Matcher<double>, Matcher<char*> >,
00068                           MatcherTuple<tuple<int, char, bool, double, char*>
00069                                       >::type>();
00070 }
00071 
00072 // Tests the Function template struct.
00073 
00074 TEST(FunctionTest, Nullary) {
00075   typedef Function<int()> F;  // NOLINT
00076   CompileAssertTypesEqual<int, F::Result>();
00077   CompileAssertTypesEqual<tuple<>, F::ArgumentTuple>();
00078   CompileAssertTypesEqual<tuple<>, F::ArgumentMatcherTuple>();
00079   CompileAssertTypesEqual<void(), F::MakeResultVoid>();
00080   CompileAssertTypesEqual<IgnoredValue(), F::MakeResultIgnoredValue>();
00081 }
00082 
00083 TEST(FunctionTest, Unary) {
00084   typedef Function<int(bool)> F;  // NOLINT
00085   CompileAssertTypesEqual<int, F::Result>();
00086   CompileAssertTypesEqual<bool, F::Argument1>();
00087   CompileAssertTypesEqual<tuple<bool>, F::ArgumentTuple>();
00088   CompileAssertTypesEqual<tuple<Matcher<bool> >, F::ArgumentMatcherTuple>();
00089   CompileAssertTypesEqual<void(bool), F::MakeResultVoid>();  // NOLINT
00090   CompileAssertTypesEqual<IgnoredValue(bool),  // NOLINT
00091       F::MakeResultIgnoredValue>();
00092 }
00093 
00094 TEST(FunctionTest, Binary) {
00095   typedef Function<int(bool, const long&)> F;  // NOLINT
00096   CompileAssertTypesEqual<int, F::Result>();
00097   CompileAssertTypesEqual<bool, F::Argument1>();
00098   CompileAssertTypesEqual<const long&, F::Argument2>();  // NOLINT
00099   CompileAssertTypesEqual<tuple<bool, const long&>, F::ArgumentTuple>();  // NOLINT
00100   CompileAssertTypesEqual<tuple<Matcher<bool>, Matcher<const long&> >,  // NOLINT
00101                           F::ArgumentMatcherTuple>();
00102   CompileAssertTypesEqual<void(bool, const long&), F::MakeResultVoid>();  // NOLINT
00103   CompileAssertTypesEqual<IgnoredValue(bool, const long&),  // NOLINT
00104       F::MakeResultIgnoredValue>();
00105 }
00106 
00107 TEST(FunctionTest, LongArgumentList) {
00108   typedef Function<char(bool, int, char*, int&, const long&)> F;  // NOLINT
00109   CompileAssertTypesEqual<char, F::Result>();
00110   CompileAssertTypesEqual<bool, F::Argument1>();
00111   CompileAssertTypesEqual<int, F::Argument2>();
00112   CompileAssertTypesEqual<char*, F::Argument3>();
00113   CompileAssertTypesEqual<int&, F::Argument4>();
00114   CompileAssertTypesEqual<const long&, F::Argument5>();  // NOLINT
00115   CompileAssertTypesEqual<tuple<bool, int, char*, int&, const long&>,  // NOLINT
00116                           F::ArgumentTuple>();
00117   CompileAssertTypesEqual<tuple<Matcher<bool>, Matcher<int>, Matcher<char*>,
00118                                 Matcher<int&>, Matcher<const long&> >,  // NOLINT
00119                           F::ArgumentMatcherTuple>();
00120   CompileAssertTypesEqual<void(bool, int, char*, int&, const long&),  // NOLINT
00121                           F::MakeResultVoid>();
00122   CompileAssertTypesEqual<
00123       IgnoredValue(bool, int, char*, int&, const long&),  // NOLINT
00124       F::MakeResultIgnoredValue>();
00125 }
00126 
00127 }  // Unnamed namespace


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Sat Jun 8 2019 18:24:41