YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
CApiMock.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#pragma once
20
21#include "../InterfaceForCApi.h"
22#include "gmock/gmock.h"
23#include "gtest/gtest.h"
24
25// Dummy
26struct udev {
27 int dummy;
28};
29
31 int dummy;
32};
33
34// Mock
36public:
37 MOCK_METHOD(int, open_c, (const char *, int), (override));
38 MOCK_METHOD(int, open_c, (const char *, int, mode_t), (override));
39 MOCK_METHOD(struct udev *, udev_new_c, (), (override));
40 MOCK_METHOD(int, ioctl_media_c, (int, int, struct media_entity_desc &),
41 (override));
42 MOCK_METHOD(int, ioctl_control_c, (int, int, struct v4l2_control &),
43 (override));
44 MOCK_METHOD(int, ioctl_query_c, (int, int, struct v4l2_queryctrl &),
45 (override));
46 MOCK_METHOD(int, xioctl, (int, int, void *), (override));
47 MOCK_METHOD(int, xioctl_v4l2, (int, int, struct v4l2_buffer *), (override));
48
49 MOCK_METHOD(dev_t, makedev_c, (int, int), (override));
51 (struct udev *, char, dev_t), (override));
53 (override));
55 (override));
56 MOCK_METHOD(void *, mmap_c, (void *, size_t, int, int, int, __off_t),
57 (override));
59 (int, fd_set *, fd_set *, fd_set *, struct timeval *),
60 (override));
61 MOCK_METHOD(void *, memcpy_c, (void *, const void *, size_t), (override));
62};
63
64// Equal operator
65inline bool operator==(const struct v4l2_control &left,
66 const struct v4l2_control &right) {
67 if (left.id != right.id)
68 return false;
69 if (left.value != right.value)
70 return false;
71 return true;
72}
bool operator==(const struct v4l2_control &left, const struct v4l2_control &right)
Definition CApiMock.h:65
MOCK_METHOD(int, open_c,(const char *, int),(override))
MOCK_METHOD(int, open_c,(const char *, int, mode_t),(override))
MOCK_METHOD(struct udev_device *, udev_device_unref_c,(struct udev_device *),(override))
MOCK_METHOD(void *, memcpy_c,(void *, const void *, size_t),(override))
MOCK_METHOD(int, select_c,(int, fd_set *, fd_set *, fd_set *, struct timeval *),(override))
MOCK_METHOD(struct udev_device *, udev_device_new_from_devnum_c,(struct udev *, char, dev_t),(override))
MOCK_METHOD(void *, mmap_c,(void *, size_t, int, int, int, __off_t),(override))
MOCK_METHOD(int, ioctl_control_c,(int, int, struct v4l2_control &),(override))
MOCK_METHOD(struct udev *, udev_new_c,(),(override))
MOCK_METHOD(int, ioctl_media_c,(int, int, struct media_entity_desc &),(override))
MOCK_METHOD(int, ioctl_query_c,(int, int, struct v4l2_queryctrl &),(override))
MOCK_METHOD(int, xioctl_v4l2,(int, int, struct v4l2_buffer *),(override))
MOCK_METHOD(int, xioctl,(int, int, void *),(override))
MOCK_METHOD(const char *, udev_device_get_devnode_c,(struct udev_device *),(override))
MOCK_METHOD(dev_t, makedev_c,(int, int),(override))
virtual int xioctl_v4l2(int fh, int request, struct v4l2_buffer *arg)
virtual int ioctl_query_c(int fd, int value, struct v4l2_queryctrl &info)
virtual struct udev * udev_new_c()
virtual struct udev_device * udev_device_new_from_devnum_c(struct udev *udev, char type, dev_t devnum)
virtual dev_t makedev_c(int major, int minor)
virtual int open_c(const char *path, int oflag)
virtual struct udev_device * udev_device_unref_c(struct udev_device *udev_device)
virtual const char * udev_device_get_devnode_c(struct udev_device *udev_device)
virtual int xioctl(int fh, int request, void *arg)
virtual int ioctl_media_c(int fd, int value, struct media_entity_desc &info)
virtual int select_c(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
virtual void * mmap_c(void *addr, size_t len, int prot, int flags, int fd, __off_t offset)
virtual int ioctl_control_c(int fd, int value, struct v4l2_control &info)
virtual void * memcpy_c(void *dest, const void *src, size_t size)
int dummy
Definition CApiMock.h:27