1 | /** |
2 | * Copyright 2021 Alibaba, Inc. and its affiliates. All Rights Reserved. |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | * |
16 | * \author guonix |
17 | * \date Dec 2020 |
18 | * \brief |
19 | */ |
20 | #pragma once |
21 | |
22 | #include <gmock/gmock.h> |
23 | #include "query/executor/executor.h" |
24 | |
25 | using namespace proxima::be::query; |
26 | |
27 | class MockExecutor : public Executor { |
28 | public: |
29 | ~MockExecutor() override = default; |
30 | |
31 | public: |
32 | //! Execute one task |
33 | MOCK_METHOD(int, execute_task, (const TaskPtr &task), (override)); |
34 | //! Execute tasks |
35 | MOCK_METHOD(int, execute_tasks, (const TaskPtrList &tasks), (override)); |
36 | }; |
37 | |
38 | MATCHER(TaskPtrMatcher, "" ) { |
39 | return typeid(arg) == typeid(TaskPtr); |
40 | } |
41 | |
42 | MATCHER(TaskListMatcher, "" ) { |
43 | return typeid(arg) == typeid(TaskPtrList); |
44 | } |
45 | |
46 | using MockExecutorPtr = std::shared_ptr<MockExecutor>; |
47 | |