File: mock_socket.h

package info (click to toggle)
ros-ros-comm 1.17.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 12,008 kB
  • sloc: cpp: 41,963; python: 38,967; xml: 2,663; ansic: 2,384; sh: 274; makefile: 27
file content (47 lines) | stat: -rw-r--r-- 1,630 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * Unit tests for XmlRpc++
 *
 * Copyright (C) 2017, Zoox Inc
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Austin Hendrix <austin@zoox.com>
 *
 */

#pragma once
#include <string>
#include <gtest/gtest.h>

class MockSocketTest : public ::testing::Test {
protected:
  void SetUp();

  void CheckCalls();
  void TearDown();

  void Expect_socket(int ret);
  void Expect_close(int fd);
  void Expect_setNonBlocking(int fd, bool ret);
  void Expect_setReuseAddr(int fd, bool ret);
  void Expect_bind(int fd, int port, bool ret);
  void Expect_listen(int fd, int backlog, bool ret);
  void Expect_accept(int fd, int ret);
  void Expect_connect(int fd, const std::string& host, int port, bool ret);
  void Expect_nbRead(int fd, const std::string& s, bool eof, bool ret);
  void Expect_nbWrite(int fd, const std::string& s, int bytes, bool ret);
  void Expect_getError(int ret);
  void Expect_get_port(int socket, int ret);
};