Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
648ac832
Commit
648ac832
authored
Oct 19, 2018
by
Jerry Turcios
Browse files
Merge branch 'master' of
https://github.com/google/googletest
parents
9424e7b0
f410177a
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
422 additions
and
4859 deletions
+422
-4859
googlemock/include/gmock/gmock-actions.h
googlemock/include/gmock/gmock-actions.h
+6
-5
googlemock/include/gmock/gmock-generated-actions.h
googlemock/include/gmock/gmock-generated-actions.h
+147
-168
googlemock/include/gmock/gmock-generated-actions.h.pump
googlemock/include/gmock/gmock-generated-actions.h.pump
+4
-2
googlemock/include/gmock/gmock-generated-function-mockers.h
googlemock/include/gmock/gmock-generated-function-mockers.h
+85
-90
googlemock/include/gmock/gmock-generated-function-mockers.h.pump
...ock/include/gmock/gmock-generated-function-mockers.h.pump
+4
-2
googlemock/include/gmock/gmock-generated-matchers.h
googlemock/include/gmock/gmock-generated-matchers.h
+66
-115
googlemock/include/gmock/gmock-generated-matchers.h.pump
googlemock/include/gmock/gmock-generated-matchers.h.pump
+3
-2
googlemock/include/gmock/gmock-matchers.h
googlemock/include/gmock/gmock-matchers.h
+8
-8
googlemock/include/gmock/gmock-spec-builders.h
googlemock/include/gmock/gmock-spec-builders.h
+18
-21
googletest/include/gtest/gtest-param-test.h
googletest/include/gtest/gtest-param-test.h
+3
-852
googletest/include/gtest/gtest-param-test.h.pump
googletest/include/gtest/gtest-param-test.h.pump
+3
-10
googletest/include/gtest/internal/gtest-param-util-generated.h
...etest/include/gtest/internal/gtest-param-util-generated.h
+0
-3507
googletest/include/gtest/internal/gtest-param-util-generated.h.pump
.../include/gtest/internal/gtest-param-util-generated.h.pump
+0
-46
googletest/include/gtest/internal/gtest-param-util.h
googletest/include/gtest/internal/gtest-param-util.h
+61
-2
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+0
-27
googletest/include/gtest/internal/gtest-type-util.h.pump
googletest/include/gtest/internal/gtest-type-util.h.pump
+1
-1
googletest/src/gtest.cc
googletest/src/gtest.cc
+1
-1
googletest/test/googletest-param-test-test.cc
googletest/test/googletest-param-test-test.cc
+12
-0
No files found.
googlemock/include/gmock/gmock-actions.h
View file @
648ac832
...
...
@@ -43,6 +43,7 @@
#include <algorithm>
#include <string>
#include <utility>
#include "gmock/internal/gmock-internal-utils.h"
#include "gmock/internal/gmock-port.h"
...
...
@@ -527,7 +528,7 @@ class ActionAdaptor : public ActionInterface<F1> {
// on return. Useful for move-only types, but could be used on any type.
template
<
typename
T
>
struct
ByMoveWrapper
{
explicit
ByMoveWrapper
(
T
value
)
:
payload
(
internal
::
move
(
value
))
{}
explicit
ByMoveWrapper
(
T
value
)
:
payload
(
std
::
move
(
value
))
{}
T
payload
;
};
...
...
@@ -564,7 +565,7 @@ class ReturnAction {
// Constructs a ReturnAction object from the value to be returned.
// 'value' is passed by value instead of by const reference in order
// to allow Return("string literal") to compile.
explicit
ReturnAction
(
R
value
)
:
value_
(
new
R
(
internal
::
move
(
value
)))
{}
explicit
ReturnAction
(
R
value
)
:
value_
(
new
R
(
std
::
move
(
value
)))
{}
// This template type conversion operator allows Return(x) to be
// used in ANY function that returns x's type.
...
...
@@ -632,7 +633,7 @@ class ReturnAction {
GTEST_CHECK_
(
!
performed_
)
<<
"A ByMove() action should only be performed once."
;
performed_
=
true
;
return
internal
::
move
(
wrapper_
->
payload
);
return
std
::
move
(
wrapper_
->
payload
);
}
private:
...
...
@@ -1116,7 +1117,7 @@ Action<To>::Action(const Action<From>& from)
// will trigger a compiler error about using array as initializer.
template
<
typename
R
>
internal
::
ReturnAction
<
R
>
Return
(
R
value
)
{
return
internal
::
ReturnAction
<
R
>
(
internal
::
move
(
value
));
return
internal
::
ReturnAction
<
R
>
(
std
::
move
(
value
));
}
// Creates an action that returns NULL.
...
...
@@ -1149,7 +1150,7 @@ inline internal::ReturnRefOfCopyAction<R> ReturnRefOfCopy(const R& x) {
// invariant.
template
<
typename
R
>
internal
::
ByMoveWrapper
<
R
>
ByMove
(
R
x
)
{
return
internal
::
ByMoveWrapper
<
R
>
(
internal
::
move
(
x
));
return
internal
::
ByMoveWrapper
<
R
>
(
std
::
move
(
x
));
}
// Creates an action that does the default action for the give mock function.
...
...
googlemock/include/gmock/gmock-generated-actions.h
View file @
648ac832
This diff is collapsed.
Click to expand it.
googlemock/include/gmock/gmock-generated-actions.h.pump
View file @
648ac832
...
...
@@ -43,6 +43,8 @@ $$}} This meta comment fixes auto-indentation in editors.
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
#include <utility>
#include "gmock/gmock-actions.h"
#include "gmock/internal/gmock-port.h"
...
...
@@ -525,7 +527,7 @@ _VALUE_PARAMS($for j, [[p$j]]) $for j [[, typename p$j##_type]]
$
for
i
[[
$
range
j
0.
.
i
-
1
#define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\
($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(::
testing::internal
::move(gmock_p$j))]]
($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(::
std
::move(gmock_p$j))]]
]]
...
...
@@ -658,7 +660,7 @@ $var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]]
$
range
j
0.
.
i
-
1
$
var
ctor_param_list
=
[[
$
for
j
,
[[
p
$
j
##
_type
gmock_p
$
j
]]]]
$
var
param_types_and_names
=
[[
$
for
j
,
[[
p
$
j
##
_type
p
$
j
]]]]
$
var
inits
=
[[
$
if
i
==
0
[[]]
$
else
[[
:
$
for
j
,
[[
p
$
j
(
::
testing
::
internal
::
forward
<
p
$
j
##
_type
>(
gmock_p
$
j
))]]]]]]
$
var
inits
=
[[
$
if
i
==
0
[[]]
$
else
[[
:
$
for
j
,
[[
p
$
j
(
::
std
::
forward
<
p
$
j
##
_type
>(
gmock_p
$
j
))]]]]]]
$
var
param_field_decls
=
[[
$
for
j
[[
...
...
googlemock/include/gmock/gmock-generated-function-mockers.h
View file @
648ac832
...
...
@@ -41,6 +41,8 @@
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#include <utility>
#include "gmock/gmock-spec-builders.h"
#include "gmock/internal/gmock-internal-utils.h"
...
...
@@ -98,7 +100,7 @@ class FunctionMocker<R(A1)> : public
// by the C++ standard [14.6.4] here, as the base class type is
// dependent on the template argument (and thus shouldn't be
// looked into when resolving InvokeWith).
return
this
->
InvokeWith
(
ArgumentTuple
(
internal
::
forward
<
A1
>
(
a1
)));
return
this
->
InvokeWith
(
ArgumentTuple
(
std
::
forward
<
A1
>
(
a1
)));
}
};
...
...
@@ -118,8 +120,8 @@ class FunctionMocker<R(A1, A2)> : public
// by the C++ standard [14.6.4] here, as the base class type is
// dependent on the template argument (and thus shouldn't be
// looked into when resolving InvokeWith).
return
this
->
InvokeWith
(
ArgumentTuple
(
internal
::
forward
<
A1
>
(
a1
),
internal
::
forward
<
A2
>
(
a2
)));
return
this
->
InvokeWith
(
ArgumentTuple
(
std
::
forward
<
A1
>
(
a1
),
std
::
forward
<
A2
>
(
a2
)));
}
};
...
...
@@ -140,8 +142,8 @@ class FunctionMocker<R(A1, A2, A3)> : public
// by the C++ standard [14.6.4] here, as the base class type is
// dependent on the template argument (and thus shouldn't be
// looked into when resolving InvokeWith).
return
this
->
InvokeWith
(
ArgumentTuple
(
internal
::
forward
<
A1
>
(
a1
),
internal
::
forward
<
A2
>
(
a2
),
internal
::
forward
<
A3
>
(
a3
)));
return
this
->
InvokeWith
(
ArgumentTuple
(
std
::
forward
<
A1
>
(
a1
),
std
::
forward
<
A2
>
(
a2
),
std
::
forward
<
A3
>
(
a3
)));
}
};
...
...
@@ -162,9 +164,8 @@ class FunctionMocker<R(A1, A2, A3, A4)> : public
// by the C++ standard [14.6.4] here, as the base class type is
// dependent on the template argument (and thus shouldn't be
// looked into when resolving InvokeWith).
return
this
->
InvokeWith
(
ArgumentTuple
(
internal
::
forward
<
A1
>
(
a1
),
internal
::
forward
<
A2
>
(
a2
),
internal
::
forward
<
A3
>
(
a3
),
internal
::
forward
<
A4
>
(
a4
)));
return
this
->
InvokeWith
(
ArgumentTuple
(
std
::
forward
<
A1
>
(
a1
),
std
::
forward
<
A2
>
(
a2
),
std
::
forward
<
A3
>
(
a3
),
std
::
forward
<
A4
>
(
a4
)));
}
};
...
...
@@ -186,9 +187,9 @@ class FunctionMocker<R(A1, A2, A3, A4, A5)> : public
// by the C++ standard [14.6.4] here, as the base class type is
// dependent on the template argument (and thus shouldn't be
// looked into when resolving InvokeWith).
return
this
->
InvokeWith
(
ArgumentTuple
(
internal
::
forward
<
A1
>
(
a1
),
internal
::
forward
<
A2
>
(
a2
),
internal
::
forward
<
A3
>
(
a3
),
internal
::
forward
<
A4
>
(
a4
),
internal
::
forward
<
A5
>
(
a5
)));
return
this
->
InvokeWith
(
ArgumentTuple
(
std
::
forward
<
A1
>
(
a1
),
std
::
forward
<
A2
>
(
a2
),
std
::
forward
<
A3
>
(
a3
),
std
::
forward
<
A4
>
(
a4
),
std
::
forward
<
A5
>
(
a5
)));
}
};
...
...
@@ -211,10 +212,9 @@ class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public
// by the C++ standard [14.6.4] here, as the base class type is
// dependent on the template argument (and thus shouldn't be
// looked into when resolving InvokeWith).
return
this
->
InvokeWith
(
ArgumentTuple
(
internal
::
forward
<
A1
>
(
a1
),
internal
::
forward
<
A2
>
(
a2
),
internal
::
forward
<
A3
>
(
a3
),
internal
::
forward
<
A4
>
(
a4
),
internal
::
forward
<
A5
>
(
a5
),
internal
::
forward
<
A6
>
(
a6
)));
return
this
->
InvokeWith
(
ArgumentTuple
(
std
::
forward
<
A1
>
(
a1
),
std
::
forward
<
A2
>
(
a2
),
std
::
forward
<
A3
>
(
a3
),
std
::
forward
<
A4
>
(
a4
),
std
::
forward
<
A5
>
(
a5
),
std
::
forward
<
A6
>
(
a6
)));
}
};
...
...
@@ -237,10 +237,9 @@ class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public
// by the C++ standard [14.6.4] here, as the base class type is
// dependent on the template argument (and thus shouldn't be
// looked into when resolving InvokeWith).
return
this
->
InvokeWith
(
ArgumentTuple
(
internal
::
forward
<
A1
>
(
a1
),
internal
::
forward
<
A2
>
(
a2
),
internal
::
forward
<
A3
>
(
a3
),
internal
::
forward
<
A4
>
(
a4
),
internal
::
forward
<
A5
>
(
a5
),
internal
::
forward
<
A6
>
(
a6
),
internal
::
forward
<
A7
>
(
a7
)));
return
this
->
InvokeWith
(
ArgumentTuple
(
std
::
forward
<
A1
>
(
a1
),
std
::
forward
<
A2
>
(
a2
),
std
::
forward
<
A3
>
(
a3
),
std
::
forward
<
A4
>
(
a4
),
std
::
forward
<
A5
>
(
a5
),
std
::
forward
<
A6
>
(
a6
),
std
::
forward
<
A7
>
(
a7
)));
}
};
...
...
@@ -263,11 +262,10 @@ class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public
// by the C++ standard [14.6.4] here, as the base class type is
// dependent on the template argument (and thus shouldn't be
// looked into when resolving InvokeWith).
return
this
->
InvokeWith
(
ArgumentTuple
(
internal
::
forward
<
A1
>
(
a1
),
internal
::
forward
<
A2
>
(
a2
),
internal
::
forward
<
A3
>
(
a3
),
internal
::
forward
<
A4
>
(
a4
),
internal
::
forward
<
A5
>
(
a5
),
internal
::
forward
<
A6
>
(
a6
),
internal
::
forward
<
A7
>
(
a7
),
internal
::
forward
<
A8
>
(
a8
)));
return
this
->
InvokeWith
(
ArgumentTuple
(
std
::
forward
<
A1
>
(
a1
),
std
::
forward
<
A2
>
(
a2
),
std
::
forward
<
A3
>
(
a3
),
std
::
forward
<
A4
>
(
a4
),
std
::
forward
<
A5
>
(
a5
),
std
::
forward
<
A6
>
(
a6
),
std
::
forward
<
A7
>
(
a7
),
std
::
forward
<
A8
>
(
a8
)));
}
};
...
...
@@ -292,11 +290,10 @@ class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public
// by the C++ standard [14.6.4] here, as the base class type is
// dependent on the template argument (and thus shouldn't be
// looked into when resolving InvokeWith).
return
this
->
InvokeWith
(
ArgumentTuple
(
internal
::
forward
<
A1
>
(
a1
),
internal
::
forward
<
A2
>
(
a2
),
internal
::
forward
<
A3
>
(
a3
),
internal
::
forward
<
A4
>
(
a4
),
internal
::
forward
<
A5
>
(
a5
),
internal
::
forward
<
A6
>
(
a6
),
internal
::
forward
<
A7
>
(
a7
),
internal
::
forward
<
A8
>
(
a8
),
internal
::
forward
<
A9
>
(
a9
)));
return
this
->
InvokeWith
(
ArgumentTuple
(
std
::
forward
<
A1
>
(
a1
),
std
::
forward
<
A2
>
(
a2
),
std
::
forward
<
A3
>
(
a3
),
std
::
forward
<
A4
>
(
a4
),
std
::
forward
<
A5
>
(
a5
),
std
::
forward
<
A6
>
(
a6
),
std
::
forward
<
A7
>
(
a7
),
std
::
forward
<
A8
>
(
a8
),
std
::
forward
<
A9
>
(
a9
)));
}
};
...
...
@@ -323,12 +320,10 @@ class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
// by the C++ standard [14.6.4] here, as the base class type is
// dependent on the template argument (and thus shouldn't be
// looked into when resolving InvokeWith).
return
this
->
InvokeWith
(
ArgumentTuple
(
internal
::
forward
<
A1
>
(
a1
),
internal
::
forward
<
A2
>
(
a2
),
internal
::
forward
<
A3
>
(
a3
),
internal
::
forward
<
A4
>
(
a4
),
internal
::
forward
<
A5
>
(
a5
),
internal
::
forward
<
A6
>
(
a6
),
internal
::
forward
<
A7
>
(
a7
),
internal
::
forward
<
A8
>
(
a8
),
internal
::
forward
<
A9
>
(
a9
),
internal
::
forward
<
A10
>
(
a10
)));
return
this
->
InvokeWith
(
ArgumentTuple
(
std
::
forward
<
A1
>
(
a1
),
std
::
forward
<
A2
>
(
a2
),
std
::
forward
<
A3
>
(
a3
),
std
::
forward
<
A4
>
(
a4
),
std
::
forward
<
A5
>
(
a5
),
std
::
forward
<
A6
>
(
a6
),
std
::
forward
<
A7
>
(
a7
),
std
::
forward
<
A8
>
(
a8
),
std
::
forward
<
A9
>
(
a9
),
std
::
forward
<
A10
>
(
a10
)));
}
};
...
...
@@ -451,7 +446,7 @@ using internal::FunctionMocker;
this_method_does_not_take_1_argument); \
GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(1, constness, \
Method).Invoke(::
testing::internal
::forward<GMOCK_ARG_(tn, 1, \
Method).Invoke(::
std
::forward<GMOCK_ARG_(tn, 1, \
__VA_ARGS__)>(gmock_a1)); \
} \
::testing::MockSpec<__VA_ARGS__> \
...
...
@@ -479,9 +474,9 @@ using internal::FunctionMocker;
this_method_does_not_take_2_arguments); \
GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(2, constness, \
Method).Invoke(::
testing::internal
::forward<GMOCK_ARG_(tn, 1, \
Method).Invoke(::
std
::forward<GMOCK_ARG_(tn, 1, \
__VA_ARGS__)>(gmock_a1), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2)); \
::
std
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2)); \
} \
::testing::MockSpec<__VA_ARGS__> \
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
...
...
@@ -511,10 +506,10 @@ using internal::FunctionMocker;
this_method_does_not_take_3_arguments); \
GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(3, constness, \
Method).Invoke(::
testing::internal
::forward<GMOCK_ARG_(tn, 1, \
Method).Invoke(::
std
::forward<GMOCK_ARG_(tn, 1, \
__VA_ARGS__)>(gmock_a1), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3)); \
::
std
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
std
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3)); \
} \
::testing::MockSpec<__VA_ARGS__> \
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
...
...
@@ -547,11 +542,11 @@ using internal::FunctionMocker;
this_method_does_not_take_4_arguments); \
GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(4, constness, \
Method).Invoke(::
testing::internal
::forward<GMOCK_ARG_(tn, 1, \
Method).Invoke(::
std
::forward<GMOCK_ARG_(tn, 1, \
__VA_ARGS__)>(gmock_a1), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4)); \
::
std
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
std
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
std
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4)); \
} \
::testing::MockSpec<__VA_ARGS__> \
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
...
...
@@ -587,12 +582,12 @@ using internal::FunctionMocker;
this_method_does_not_take_5_arguments); \
GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(5, constness, \
Method).Invoke(::
testing::internal
::forward<GMOCK_ARG_(tn, 1, \
Method).Invoke(::
std
::forward<GMOCK_ARG_(tn, 1, \
__VA_ARGS__)>(gmock_a1), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5)); \
::
std
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
std
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
std
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
std
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5)); \
} \
::testing::MockSpec<__VA_ARGS__> \
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
...
...
@@ -631,13 +626,13 @@ using internal::FunctionMocker;
this_method_does_not_take_6_arguments); \
GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(6, constness, \
Method).Invoke(::
testing::internal
::forward<GMOCK_ARG_(tn, 1, \
Method).Invoke(::
std
::forward<GMOCK_ARG_(tn, 1, \
__VA_ARGS__)>(gmock_a1), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6)); \
::
std
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
std
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
std
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
std
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
::
std
::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6)); \
} \
::testing::MockSpec<__VA_ARGS__> \
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
...
...
@@ -678,14 +673,14 @@ using internal::FunctionMocker;
this_method_does_not_take_7_arguments); \
GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(7, constness, \
Method).Invoke(::
testing::internal
::forward<GMOCK_ARG_(tn, 1, \
Method).Invoke(::
std
::forward<GMOCK_ARG_(tn, 1, \
__VA_ARGS__)>(gmock_a1), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7)); \
::
std
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
std
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
std
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
std
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
::
std
::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
::
std
::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7)); \
} \
::testing::MockSpec<__VA_ARGS__> \
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
...
...
@@ -729,15 +724,15 @@ using internal::FunctionMocker;
this_method_does_not_take_8_arguments); \
GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(8, constness, \
Method).Invoke(::
testing::internal
::forward<GMOCK_ARG_(tn, 1, \
Method).Invoke(::
std
::forward<GMOCK_ARG_(tn, 1, \
__VA_ARGS__)>(gmock_a1), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8)); \
::
std
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
std
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
std
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
std
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
::
std
::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
::
std
::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \
::
std
::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8)); \
} \
::testing::MockSpec<__VA_ARGS__> \
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
...
...
@@ -784,16 +779,16 @@ using internal::FunctionMocker;
this_method_does_not_take_9_arguments); \
GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(9, constness, \
Method).Invoke(::
testing::internal
::forward<GMOCK_ARG_(tn, 1, \
Method).Invoke(::
std
::forward<GMOCK_ARG_(tn, 1, \
__VA_ARGS__)>(gmock_a1), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(gmock_a9)); \
::
std
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
std
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
std
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
std
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
::
std
::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
::
std
::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \
::
std
::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8), \
::
std
::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(gmock_a9)); \
} \
::testing::MockSpec<__VA_ARGS__> \
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
...
...
@@ -843,17 +838,17 @@ using internal::FunctionMocker;
this_method_does_not_take_10_arguments); \
GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(10, constness, \
Method).Invoke(::
testing::internal
::forward<GMOCK_ARG_(tn, 1, \
Method).Invoke(::
std
::forward<GMOCK_ARG_(tn, 1, \
__VA_ARGS__)>(gmock_a1), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(gmock_a9), \
::
testing::internal
::forward<GMOCK_ARG_(tn, 10, __VA_ARGS__)>(gmock_a10)); \
::
std
::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
::
std
::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
::
std
::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
::
std
::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
::
std
::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
::
std
::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \
::
std
::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8), \
::
std
::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(gmock_a9), \
::
std
::forward<GMOCK_ARG_(tn, 10, __VA_ARGS__)>(gmock_a10)); \
} \
::testing::MockSpec<__VA_ARGS__> \
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
...
...
googlemock/include/gmock/gmock-generated-function-mockers.h.pump
View file @
648ac832
...
...
@@ -42,6 +42,8 @@ $var n = 10 $$ The maximum arity we support.
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#include <utility>
#include "gmock/gmock-spec-builders.h"
#include "gmock/internal/gmock-internal-utils.h"
...
...
@@ -69,7 +71,7 @@ $for i [[
$
range
j
1.
.
i
$
var
typename_As
=
[[
$
for
j
[[,
typename
A
$
j
]]]]
$
var
As
=
[[
$
for
j
,
[[
A
$
j
]]]]
$
var
as
=
[[
$
for
j
,
[[
internal
::
forward
<
A
$
j
>
(
a
$
j
)]]]]
$
var
as
=
[[
$
for
j
,
[[
std
::
forward
<
A
$
j
>
(
a
$
j
)]]]]
$
var
Aas
=
[[
$
for
j
,
[[
A
$
j
a
$
j
]]]]
$
var
ms
=
[[
$
for
j
,
[[
m
$
j
]]]]
$
var
matchers
=
[[
$
for
j
,
[[
const
Matcher
<
A
$
j
>&
m
$
j
]]]]
...
...
@@ -184,7 +186,7 @@ $for i [[
$
range
j
1.
.
i
$
var
arg_as
=
[[
$
for
j
,
[[
GMOCK_ARG_
(
tn
,
$
j
,
__VA_ARGS__
)
gmock_a
$
j
]]]]
$
var
as
=
[[
$
for
j
,
\
[[
::
testing
::
internal
::
forward
<
GMOCK_ARG_
(
tn
,
$
j
,
__VA_ARGS__
)
>
(
gmock_a
$
j
)]]]]
[[
::
std
::
forward
<
GMOCK_ARG_
(
tn
,
$
j
,
__VA_ARGS__
)
>
(
gmock_a
$
j
)]]]]
$
var
matcher_arg_as
=
[[
$
for
j
,
\
[[
GMOCK_MATCHER_
(
tn
,
$
j
,
__VA_ARGS__
)
gmock_a
$
j
]]]]
$
var
matcher_as
=
[[
$
for
j
,
[[
gmock_a
$
j
]]]]
...
...
googlemock/include/gmock/gmock-generated-matchers.h
View file @
648ac832
...
...
@@ -43,6 +43,7 @@
#include <iterator>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include "gmock/gmock-matchers.h"
...
...
@@ -380,7 +381,6 @@ Args(const InnerMatcher& matcher) {
}
}
// namespace testing
...
...
@@ -657,7 +657,7 @@ Args(const InnerMatcher& matcher) {
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\
explicit gmock_Impl(p0##_type gmock_p0)\
: p0(::
testing::internal
::move(gmock_p0)) {}\
: p0(::
std
::move(gmock_p0)) {}\
virtual bool MatchAndExplain(\
GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
...
...
@@ -685,8 +685,7 @@ Args(const InnerMatcher& matcher) {
return ::testing::Matcher<arg_type>(\
new gmock_Impl<arg_type>(p0));\
}\
explicit name##MatcherP(p0##_type gmock_p0) : \
p0(::testing::internal::move(gmock_p0)) {\
explicit name##MatcherP(p0##_type gmock_p0) : p0(::std::move(gmock_p0)) {\
}\
p0##_type const p0;\
private:\
...
...
@@ -711,8 +710,7 @@ Args(const InnerMatcher& matcher) {
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\
: p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)) {}\
: p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)) {}\
virtual bool MatchAndExplain(\
GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
...
...
@@ -742,8 +740,8 @@ Args(const InnerMatcher& matcher) {
new gmock_Impl<arg_type>(p0, p1));\
}\
name##MatcherP2(p0##_type gmock_p0, \
p1##_type gmock_p1) : p0(::
testing::internal
::move(gmock_p0)), \
p1(::
testing::internal
::move(gmock_p1)) {\
p1##_type gmock_p1) : p0(::
std
::move(gmock_p0)), \
p1(::
std
::move(gmock_p1)) {\
}\
p0##_type const p0;\
p1##_type const p1;\
...
...
@@ -771,9 +769,8 @@ Args(const InnerMatcher& matcher) {
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\
: p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)) {}\
: p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
p2(::std::move(gmock_p2)) {}\
virtual bool MatchAndExplain(\
GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
...
...
@@ -804,9 +801,8 @@ Args(const InnerMatcher& matcher) {
new gmock_Impl<arg_type>(p0, p1, p2));\
}\
name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)) {\
p2##_type gmock_p2) : p0(::std::move(gmock_p0)), \
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)) {\
}\
p0##_type const p0;\
p1##_type const p1;\
...
...
@@ -837,10 +833,8 @@ Args(const InnerMatcher& matcher) {
public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3)\
: p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)) {}\
: p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)) {}\
virtual bool MatchAndExplain(\
GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
...
...
@@ -873,11 +867,9 @@ Args(const InnerMatcher& matcher) {
new gmock_Impl<arg_type>(p0, p1, p2, p3));\
}\
name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, \
p3##_type gmock_p3) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)) {\
p2##_type gmock_p2, p3##_type gmock_p3) : p0(::std::move(gmock_p0)), \
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
p3(::std::move(gmock_p3)) {\
}\
p0##_type const p0;\
p1##_type const p1;\
...
...
@@ -913,11 +905,9 @@ Args(const InnerMatcher& matcher) {
public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4)\
: p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)) {}\
: p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
p4(::std::move(gmock_p4)) {}\
virtual bool MatchAndExplain(\
GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
...
...
@@ -952,11 +942,9 @@ Args(const InnerMatcher& matcher) {
}\
name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, \
p4##_type gmock_p4) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)) {\
p4##_type gmock_p4) : p0(::std::move(gmock_p0)), \
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)) {\
}\
p0##_type const p0;\
p1##_type const p1;\
...
...
@@ -993,12 +981,9 @@ Args(const InnerMatcher& matcher) {
public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\
: p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)) {}\
: p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)) {}\
virtual bool MatchAndExplain(\
GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
...
...
@@ -1034,12 +1019,10 @@ Args(const InnerMatcher& matcher) {
}\
name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)) {\
p5##_type gmock_p5) : p0(::std::move(gmock_p0)), \
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
p5(::std::move(gmock_p5)) {\
}\
p0##_type const p0;\
p1##_type const p1;\
...
...
@@ -1079,13 +1062,10 @@ Args(const InnerMatcher& matcher) {
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6)\
: p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)) {}\
: p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \
p6(::std::move(gmock_p6)) {}\
virtual bool MatchAndExplain(\
GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
...
...
@@ -1123,14 +1103,10 @@ Args(const InnerMatcher& matcher) {
}\
name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, \
p6##_type gmock_p6) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)) {\
p5##_type gmock_p5, p6##_type gmock_p6) : p0(::std::move(gmock_p0)), \
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)) {\
}\
p0##_type const p0;\
p1##_type const p1;\
...
...
@@ -1174,14 +1150,10 @@ Args(const InnerMatcher& matcher) {
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7)\
: p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)) {}\
: p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \
p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)) {}\
virtual bool MatchAndExplain(\
GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
...
...
@@ -1221,14 +1193,11 @@ Args(const InnerMatcher& matcher) {
name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, \
p7##_type gmock_p7) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)) {\
p7##_type gmock_p7) : p0(::std::move(gmock_p0)), \
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
p7(::std::move(gmock_p7)) {\
}\
p0##_type const p0;\
p1##_type const p1;\
...
...
@@ -1275,15 +1244,11 @@ Args(const InnerMatcher& matcher) {
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\
: p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)) {}\
: p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \
p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)), \
p8(::std::move(gmock_p8)) {}\
virtual bool MatchAndExplain(\
GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
...
...
@@ -1324,15 +1289,11 @@ Args(const InnerMatcher& matcher) {
name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)) {\
p8##_type gmock_p8) : p0(::std::move(gmock_p0)), \
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)) {\
}\
p0##_type const p0;\
p1##_type const p1;\
...
...
@@ -1383,16 +1344,11 @@ Args(const InnerMatcher& matcher) {
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
p9##_type gmock_p9)\
: p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)), \
p9(::testing::internal::move(gmock_p9)) {}\
: p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \
p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)), \
p8(::std::move(gmock_p8)), p9(::std::move(gmock_p9)) {}\
virtual bool MatchAndExplain(\
GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
...
...
@@ -1434,17 +1390,12 @@ Args(const InnerMatcher& matcher) {
name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8, \
p9##_type gmock_p9) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)), \
p9(::testing::internal::move(gmock_p9)) {\
p8##_type gmock_p8, p9##_type gmock_p9) : p0(::std::move(gmock_p0)), \
p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)), \
p9(::std::move(gmock_p9)) {\
}\
p0##_type const p0;\
p1##_type const p1;\
...
...
googlemock/include/gmock/gmock-generated-matchers.h.pump
View file @
648ac832
...
...
@@ -45,6 +45,7 @@ $$ }} This line fixes auto-indentation of the following code in Emacs.
#include <iterator>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include "gmock/gmock-matchers.h"
...
...
@@ -442,8 +443,8 @@ $var template = [[$if i==0 [[]] $else [[
]]]]
$
var
ctor_param_list
=
[[
$
for
j
,
[[
p
$
j
##
_type
gmock_p
$
j
]]]]
$
var
impl_ctor_param_list
=
[[
$
for
j
,
[[
p
$
j
##
_type
gmock_p
$
j
]]]]
$
var
impl_inits
=
[[
$
if
i
==
0
[[]]
$
else
[[
:
$
for
j
,
[[
p
$
j
(
::
testing
::
internal
::
move
(
gmock_p
$
j
))]]]]]]
$
var
inits
=
[[
$
if
i
==
0
[[]]
$
else
[[
:
$
for
j
,
[[
p
$
j
(
::
testing
::
internal
::
move
(
gmock_p
$
j
))]]]]]]
$
var
impl_inits
=
[[
$
if
i
==
0
[[]]
$
else
[[
:
$
for
j
,
[[
p
$
j
(
::
std
::
move
(
gmock_p
$
j
))]]]]]]
$
var
inits
=
[[
$
if
i
==
0
[[]]
$
else
[[
:
$
for
j
,
[[
p
$
j
(
::
std
::
move
(
gmock_p
$
j
))]]]]]]
$
var
params
=
[[
$
for
j
,
[[
p
$
j
]]]]
$
var
param_types
=
[[
$
if
i
==
0
[[]]
$
else
[[
<
$
for
j
,
[[
p
$
j
##
_type
]]>]]]]
$
var
param_types_and_names
=
[[
$
for
j
,
[[
p
$
j
##
_type
p
$
j
]]]]
...
...
googlemock/include/gmock/gmock-matchers.h
View file @
648ac832
...
...
@@ -1717,7 +1717,7 @@ class AllOfMatcherImpl
:
public
MatcherInterface
<
GTEST_REFERENCE_TO_CONST_
(
T
)
>
{
public:
explicit
AllOfMatcherImpl
(
std
::
vector
<
Matcher
<
T
>
>
matchers
)
:
matchers_
(
internal
::
move
(
matchers
))
{}
:
matchers_
(
std
::
move
(
matchers
))
{}
virtual
void
DescribeTo
(
::
std
::
ostream
*
os
)
const
{
*
os
<<
"("
;
...
...
@@ -1791,7 +1791,7 @@ class VariadicMatcher {
operator
Matcher
<
T
>
()
const
{
std
::
vector
<
Matcher
<
T
>
>
values
;
CreateVariadicMatcher
<
T
>
(
&
values
,
std
::
integral_constant
<
size_t
,
0
>
());
return
Matcher
<
T
>
(
new
CombiningMatcher
<
T
>
(
internal
::
move
(
values
)));
return
Matcher
<
T
>
(
new
CombiningMatcher
<
T
>
(
std
::
move
(
values
)));
}
private:
...
...
@@ -1824,7 +1824,7 @@ class AnyOfMatcherImpl
:
public
MatcherInterface
<
GTEST_REFERENCE_TO_CONST_
(
T
)
>
{
public:
explicit
AnyOfMatcherImpl
(
std
::
vector
<
Matcher
<
T
>
>
matchers
)
:
matchers_
(
internal
::
move
(
matchers
))
{}
:
matchers_
(
std
::
move
(
matchers
))
{}
virtual
void
DescribeTo
(
::
std
::
ostream
*
os
)
const
{
*
os
<<
"("
;
...
...
@@ -1965,7 +1965,7 @@ class MatcherAsPredicate {
template
<
typename
M
>
class
PredicateFormatterFromMatcher
{
public:
explicit
PredicateFormatterFromMatcher
(
M
m
)
:
matcher_
(
internal
::
move
(
m
))
{}
explicit
PredicateFormatterFromMatcher
(
M
m
)
:
matcher_
(
std
::
move
(
m
))
{}
// This template () operator allows a PredicateFormatterFromMatcher
// object to act as a predicate-formatter suitable for using with
...
...
@@ -2009,7 +2009,7 @@ class PredicateFormatterFromMatcher {
template
<
typename
M
>
inline
PredicateFormatterFromMatcher
<
M
>
MakePredicateFormatterFromMatcher
(
M
matcher
)
{
return
PredicateFormatterFromMatcher
<
M
>
(
internal
::
move
(
matcher
));
return
PredicateFormatterFromMatcher
<
M
>
(
std
::
move
(
matcher
));
}
// Implements the polymorphic floating point equality matcher, which matches
...
...
@@ -2569,7 +2569,7 @@ template <typename Callable, typename InnerMatcher>
class
ResultOfMatcher
{
public:
ResultOfMatcher
(
Callable
callable
,
InnerMatcher
matcher
)
:
callable_
(
internal
::
move
(
callable
)),
matcher_
(
internal
::
move
(
matcher
))
{
:
callable_
(
std
::
move
(
callable
)),
matcher_
(
std
::
move
(
matcher
))
{
CallableTraits
<
Callable
>::
CheckIsValid
(
callable_
);
}
...
...
@@ -4008,7 +4008,7 @@ template <typename T>
class
VariantMatcher
{
public:
explicit
VariantMatcher
(
::
testing
::
Matcher
<
const
T
&>
matcher
)
:
matcher_
(
internal
::
move
(
matcher
))
{}
:
matcher_
(
std
::
move
(
matcher
))
{}
template
<
typename
Variant
>
bool
MatchAndExplain
(
const
Variant
&
value
,
...
...
@@ -4504,7 +4504,7 @@ template <typename Callable, typename InnerMatcher>
internal
::
ResultOfMatcher
<
Callable
,
InnerMatcher
>
ResultOf
(
Callable
callable
,
InnerMatcher
matcher
)
{
return
internal
::
ResultOfMatcher
<
Callable
,
InnerMatcher
>
(
internal
::
move
(
callable
),
internal
::
move
(
matcher
));
std
::
move
(
callable
),
std
::
move
(
matcher
));
}
// String matchers.
...
...
googlemock/include/gmock/gmock-spec-builders.h
View file @
648ac832
...
...
@@ -65,6 +65,7 @@
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include "gmock/gmock-actions.h"
#include "gmock/gmock-cardinalities.h"
...
...
@@ -1320,13 +1321,13 @@ class ReferenceOrValueWrapper {
public:
// Constructs a wrapper from the given value/reference.
explicit
ReferenceOrValueWrapper
(
T
value
)
:
value_
(
::
testing
::
internal
::
move
(
value
))
{
:
value_
(
std
::
move
(
value
))
{
}
// Unwraps and returns the underlying value/reference, exactly as
// originally passed. The behavior of calling this more than once on
// the same object is unspecified.
T
Unwrap
()
{
return
::
testing
::
internal
::
move
(
value_
);
}
T
Unwrap
()
{
return
std
::
move
(
value_
);
}
// Provides nondestructive access to the underlying value/reference.
// Always returns a const reference (more precisely,
...
...
@@ -1401,27 +1402,26 @@ class ActionResultHolder : public UntypedActionResultHolderBase {
template
<
typename
F
>
static
ActionResultHolder
*
PerformDefaultAction
(
const
FunctionMockerBase
<
F
>*
func_mocker
,
typename
RvalueRef
<
typename
Function
<
F
>::
ArgumentTuple
>::
type
args
,
typename
Function
<
F
>::
ArgumentTuple
&&
args
,
const
std
::
string
&
call_description
)
{
return
new
ActionResultHolder
(
Wrapper
(
func_mocker
->
PerformDefaultAction
(
internal
::
move
(
args
),
call_description
)));
std
::
move
(
args
),
call_description
)));
}
// Performs the given action and returns the result in a new-ed
// ActionResultHolder.
template
<
typename
F
>
static
ActionResultHolder
*
PerformAction
(
const
Action
<
F
>&
action
,
typename
RvalueRef
<
typename
Function
<
F
>::
ArgumentTuple
>::
type
args
)
{
const
Action
<
F
>&
action
,
typename
Function
<
F
>::
ArgumentTuple
&&
args
)
{
return
new
ActionResultHolder
(
Wrapper
(
action
.
Perform
(
internal
::
move
(
args
))));
Wrapper
(
action
.
Perform
(
std
::
move
(
args
))));
}
private:
typedef
ReferenceOrValueWrapper
<
T
>
Wrapper
;
explicit
ActionResultHolder
(
Wrapper
result
)
:
result_
(
::
testing
::
internal
::
move
(
result
))
{
:
result_
(
std
::
move
(
result
))
{
}
Wrapper
result_
;
...
...
@@ -1442,9 +1442,9 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
template
<
typename
F
>
static
ActionResultHolder
*
PerformDefaultAction
(
const
FunctionMockerBase
<
F
>*
func_mocker
,
typename
RvalueRef
<
typename
Function
<
F
>::
ArgumentTuple
>::
type
args
,
typename
Function
<
F
>::
ArgumentTuple
&&
args
,
const
std
::
string
&
call_description
)
{
func_mocker
->
PerformDefaultAction
(
internal
::
move
(
args
),
call_description
);
func_mocker
->
PerformDefaultAction
(
std
::
move
(
args
),
call_description
);
return
new
ActionResultHolder
;
}
...
...
@@ -1452,9 +1452,8 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
// ActionResultHolder*.
template
<
typename
F
>
static
ActionResultHolder
*
PerformAction
(
const
Action
<
F
>&
action
,
typename
RvalueRef
<
typename
Function
<
F
>::
ArgumentTuple
>::
type
args
)
{
action
.
Perform
(
internal
::
move
(
args
));
const
Action
<
F
>&
action
,
typename
Function
<
F
>::
ArgumentTuple
&&
args
)
{
action
.
Perform
(
std
::
move
(
args
));
return
new
ActionResultHolder
;
}
...
...
@@ -1509,13 +1508,12 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// mutable state of this object, and thus can be called concurrently
// without locking.
// L = *
Result
PerformDefaultAction
(
typename
RvalueRef
<
typename
Function
<
F
>::
ArgumentTuple
>::
type
args
,
const
std
::
string
&
call_description
)
const
{
Result
PerformDefaultAction
(
typename
Function
<
F
>::
ArgumentTuple
&&
args
,
const
std
::
string
&
call_description
)
const
{
const
OnCallSpec
<
F
>*
const
spec
=
this
->
FindOnCallSpec
(
args
);
if
(
spec
!=
nullptr
)
{
return
spec
->
GetAction
().
Perform
(
internal
::
move
(
args
));
return
spec
->
GetAction
().
Perform
(
std
::
move
(
args
));
}
const
std
::
string
message
=
call_description
+
...
...
@@ -1540,7 +1538,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
void
*
untyped_args
,
// must point to an ArgumentTuple
const
std
::
string
&
call_description
)
const
{
ArgumentTuple
*
args
=
static_cast
<
ArgumentTuple
*>
(
untyped_args
);
return
ResultHolder
::
PerformDefaultAction
(
this
,
internal
::
move
(
*
args
),
return
ResultHolder
::
PerformDefaultAction
(
this
,
std
::
move
(
*
args
),
call_description
);
}
...
...
@@ -1554,7 +1552,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// action deletes the mock object (and thus deletes itself).
const
Action
<
F
>
action
=
*
static_cast
<
const
Action
<
F
>*>
(
untyped_action
);
ArgumentTuple
*
args
=
static_cast
<
ArgumentTuple
*>
(
untyped_args
);
return
ResultHolder
::
PerformAction
(
action
,
internal
::
move
(
*
args
));
return
ResultHolder
::
PerformAction
(
action
,
std
::
move
(
*
args
));
}
// Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
...
...
@@ -1594,8 +1592,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// Returns the result of invoking this mock function with the given
// arguments. This function can be safely called from multiple
// threads concurrently.
Result
InvokeWith
(
typename
RvalueRef
<
typename
Function
<
F
>::
ArgumentTuple
>::
type
args
)
Result
InvokeWith
(
typename
Function
<
F
>::
ArgumentTuple
&&
args
)
GTEST_LOCK_EXCLUDED_
(
g_gmock_mutex
)
{
// const_cast is required since in C++98 we still pass ArgumentTuple around
// by const& instead of rvalue reference.
...
...
googletest/include/gtest/gtest-param-test.h
View file @
648ac832
This diff is collapsed.
Click to expand it.
googletest/include/gtest/gtest-param-test.h.pump
View file @
648ac832
...
...
@@ -335,19 +335,12 @@ internal::ParamGenerator<typename Container::value_type> ValuesIn(
//
// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
//
// Currently, Values() supports from 1 to $n parameters.
//
$
range
i
1.
.
n
$
for
i
[[
$
range
j
1.
.
i
template
<
$
for
j
,
[[
typename
T
$
j
]]>
internal
::
ValueArray
$
i
<
$
for
j
,
[[
T
$
j
]]
>
Values
(
$
for
j
,
[[
T
$
j
v
$
j
]])
{
return
internal
::
ValueArray
$
i
<
$
for
j
,
[[
T
$
j
]]
>
(
$
for
j
,
[[
v
$
j
]]);
template
<
typename
...
T
>
internal
::
ValueArray
<
T
...
>
Values
(
T
...
v
)
{
return
internal
::
ValueArray
<
T
...
>
(
std
::
move
(
v
)...);
}
]]
// Bool() allows generating tests with parameters in a set of (false, true).
//
// Synopsis:
...
...
googletest/include/gtest/internal/gtest-param-util-generated.h
View file @
648ac832
This diff is collapsed.
Click to expand it.
googletest/include/gtest/internal/gtest-param-util-generated.h.pump
View file @
648ac832
...
...
@@ -51,53 +51,7 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
namespace
testing
{
// Forward declarations of ValuesIn(), which is implemented in
// include/gtest/gtest-param-test.h.
template
<
typename
ForwardIterator
>
internal
::
ParamGenerator
<
typename
::
testing
::
internal
::
IteratorTraits
<
ForwardIterator
>::
value_type
>
ValuesIn
(
ForwardIterator
begin
,
ForwardIterator
end
);
template
<
typename
T
,
size_t
N
>
internal
::
ParamGenerator
<
T
>
ValuesIn
(
const
T
(
&
array
)[
N
]);
template
<
class
Container
>
internal
::
ParamGenerator
<
typename
Container
::
value_type
>
ValuesIn
(
const
Container
&
container
);
namespace
internal
{
// Used in the Values() function to provide polymorphic capabilities.
$
range
i
1.
.
n
$
for
i
[[
$
range
j
1.
.
i
template
<
$
for
j
,
[[
typename
T
$
j
]]>
class
ValueArray
$
i
{
public:
$
if
i
==
1
[[
explicit
]]
ValueArray
$
i
(
$
for
j
,
[[
T
$
j
v
$
j
]])
:
$
for
j
,
[[
v
$
(
j
)
_
(
v
$
j
)]]
{}
template
<
typename
T
>
operator
ParamGenerator
<
T
>
()
const
{
const
T
array
[]
=
{
$
for
j
,
[[
static_cast
<
T
>
(
v
$
(
j
)
_
)]]};
return
ValuesIn
(
array
);
}
ValueArray
$
i
(
const
ValueArray
$
i
&
other
)
:
$
for
j
,
[[
v
$
(
j
)
_
(
other
.
v
$
(
j
)
_
)]]
{}
private:
// No implementation - assignment is unsupported.
void
operator
=
(
const
ValueArray
$
i
&
other
);
$
for
j
[[
const
T
$
j
v
$
(
j
)
_
;
]]
};
]]
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
//
// Generates values from the Cartesian product of values produced
...
...
googletest/include/gtest/internal/gtest-param-util.h
View file @
648ac832
...
...
@@ -39,6 +39,7 @@
#include <iterator>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
...
...
@@ -48,7 +49,6 @@
#include "gtest/gtest-printers.h"
namespace
testing
{
// Input to a parameterized test name generator, describing a test parameter.
// Consists of the parameter value and the integer parameter index.
template
<
class
ParamType
>
...
...
@@ -72,7 +72,29 @@ struct PrintToStringParamName {
namespace
internal
{
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
//
// Utility Functions
// Block of code creating for_each_in_tuple
template
<
int
...
Is
>
struct
sequence
{};
template
<
int
N
,
int
...
Is
>
struct
generate_sequence
:
generate_sequence
<
N
-
1
,
N
-
1
,
Is
...
>
{};
template
<
int
...
Is
>
struct
generate_sequence
<
0
,
Is
...
>
:
sequence
<
Is
...
>
{};
template
<
typename
T
,
typename
F
,
int
...
Is
>
void
ForEachInTupleImpl
(
T
&&
t
,
F
f_gtest
,
sequence
<
Is
...
>
)
{
int
l
[]
=
{(
f_gtest
(
std
::
get
<
Is
>
(
t
)),
0
)...};
(
void
)
l
;
// silence "unused variable warning"
}
template
<
typename
...
T
,
typename
F
>
void
ForEachInTuple
(
const
std
::
tuple
<
T
...
>&
t
,
F
f_gtest
)
{
internal
::
ForEachInTupleImpl
(
t
,
f_gtest
,
internal
::
generate_sequence
<
sizeof
...(
T
)
>
());
}
// Outputs a message explaining invalid registration of different
// fixture class for the same test case. This may happen when
// TEST_P macro is used to define two tests with the same name
...
...
@@ -714,6 +736,43 @@ class ParameterizedTestCaseRegistry {
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
ParameterizedTestCaseRegistry
);
};
}
// namespace internal
// Forward declarations of ValuesIn(), which is implemented in
// include/gtest/gtest-param-test.h.
template
<
class
Container
>
internal
::
ParamGenerator
<
typename
Container
::
value_type
>
ValuesIn
(
const
Container
&
container
);
namespace
internal
{
// Used in the Values() function to provide polymorphic capabilities.
template
<
typename
T
>
struct
PushBack
{
template
<
typename
U
>
void
operator
()(
const
U
&
u
)
{
v_
.
push_back
(
static_cast
<
T
>
(
u
));
}
std
::
vector
<
T
>&
v_
;
};
template
<
typename
...
Ts
>
class
ValueArray
{
public:
ValueArray
(
Ts
...
v
)
:
v_
{
std
::
move
(
v
)...}
{}
template
<
typename
Tn
>
operator
ParamGenerator
<
Tn
>
()
const
{
std
::
vector
<
Tn
>
vc_accumulate
;
PushBack
<
Tn
>
fnc
{
vc_accumulate
};
ForEachInTuple
(
v_
,
fnc
);
return
ValuesIn
(
std
::
move
(
vc_accumulate
));
}
private:
std
::
tuple
<
Ts
...
>
v_
;
};
}
// namespace internal
}
// namespace testing
...
...
googletest/include/gtest/internal/gtest-port.h
View file @
648ac832
...
...
@@ -203,11 +203,6 @@
// GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127
// is suppressed.
//
// C++11 feature wrappers:
//
// testing::internal::forward - portability wrapper for std::forward.
// testing::internal::move - portability wrapper for std::move.
//
// Synchronization:
// Mutex, MutexLock, ThreadLocal, GetThreadCount()
// - synchronization primitives.
...
...
@@ -1257,28 +1252,6 @@ struct ConstRef<T&> { typedef T& type; };
#define GTEST_REFERENCE_TO_CONST_(T) \
typename ::testing::internal::ConstRef<T>::type
#if GTEST_HAS_STD_MOVE_
using
std
::
forward
;
using
std
::
move
;
template
<
typename
T
>
struct
RvalueRef
{
typedef
T
&&
type
;
};
#else // GTEST_HAS_STD_MOVE_
template
<
typename
T
>
const
T
&
move
(
const
T
&
t
)
{
return
t
;
}
template
<
typename
T
>
GTEST_ADD_REFERENCE_
(
T
)
forward
(
GTEST_ADD_REFERENCE_
(
T
)
t
)
{
return
t
;
}
template
<
typename
T
>
struct
RvalueRef
{
typedef
const
T
&
type
;
};
#endif // GTEST_HAS_STD_MOVE_
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
//
// Use ImplicitCast_ as a safe version of static_cast for upcasting in
...
...
googletest/include/gtest/internal/gtest-type-util.h.pump
View file @
648ac832
...
...
@@ -87,7 +87,7 @@ std::string GetTypeName() {
# if GTEST_HAS_CXXABI_H_
using
abi
::
__cxa_demangle
;
# endif // GTEST_HAS_CXXABI_H_
char
*
const
readable_name
=
__cxa_demangle
(
name
,
0
,
0
,
&
status
);
char
*
const
readable_name
=
__cxa_demangle
(
name
,
nullptr
,
nullptr
,
&
status
);
const
std
::
string
name_str
(
status
==
0
?
readable_name
:
name
);
free
(
readable_name
);
return
CanonicalizeForStdLibVersioning
(
name_str
);
...
...
googletest/src/gtest.cc
View file @
648ac832
...
...
@@ -5807,7 +5807,7 @@ static const char kColorEncodedHelpMessage[] =
" @G--"
GTEST_FLAG_PREFIX_
"output=@Y(@Gjson@Y|@Gxml@Y)[@G:@YDIRECTORY_PATH@G"
GTEST_PATH_SEP_
"@Y|@G:@YFILE_PATH]@D
\n
"
" Generate a JSON or XML report in the given directory or with the given
\n
"
" file name. @YFILE_PATH@D defaults to @Gtest_detail
s
.xml@D.
\n
"
" file name. @YFILE_PATH@D defaults to @Gtest_detail.xml@D.
\n
"
# if GTEST_CAN_STREAM_RESULTS_
" @G--"
GTEST_FLAG_PREFIX_
"stream_result_to=@YHOST@G:@YPORT@D
\n
"
" Stream test results to the given server.
\n
"
...
...
googletest/test/googletest-param-test-test.cc
View file @
648ac832
...
...
@@ -1031,6 +1031,18 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
INSTANTIATE_TEST_CASE_P
(
RangeZeroToFive
,
ParameterizedDerivedTest
,
Range
(
0
,
5
));
// Tests param generator working with Enums
enum
MyEnums
{
ENUM1
=
1
,
ENUM2
=
3
,
ENUM3
=
8
,
};
class
MyEnumTest
:
public
testing
::
TestWithParam
<
MyEnums
>
{};
TEST_P
(
MyEnumTest
,
ChecksParamMoreThanZero
)
{
EXPECT_GE
(
10
,
GetParam
());
}
INSTANTIATE_TEST_CASE_P
(
MyEnumTests
,
MyEnumTest
,
::
testing
::
Values
(
ENUM1
,
ENUM2
,
0
));
int
main
(
int
argc
,
char
**
argv
)
{
// Used in TestGenerationTest test case.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment