# mimick_vendor **Repository Path**: shikann/mimick_vendor ## Basic Information - **Project Name**: mimick_vendor - **Description**: Wrapper around mimick, it provides an ExternalProject build of mimick. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 3 - **Created**: 2023-07-06 - **Last Updated**: 2023-07-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mimick_vendor #### 介绍 mimick_vendor节点 围绕mimick,它提供了一个mimick的外部项目构建。 Mimick旨在成为一个简单易用且功能强大的C代码和lib库。它不依赖于外部代码生成或编译器插件来工作 - 只需将库链接到您的test case #### 软件架构 软件架构说明 https://github.com/ros2/mimick_vendor.git 文件内容: ``` . ├── CHANGELOG.rst ├── CMakeLists.txt ├── CONTRIBUTING.md ├── LICENSE ├── Mimick.zip ├── package.xml └── README.md ``` #### 安装教程 1. 下载rpm包 aarch64: ``` wget https://117.78.1.88/build/home:Chenjy3_22.03/openEuler_22.03_LTS_standard_aarch64/aarch64/mimick_vendor/ros-foxy-ros-mimick_vendor-0.2.6-2.oe2203.aarch64.rpm ``` x86_64: ``` wget https://117.78.1.88/build/home:Chenjy3_22.03/openEuler_22.03_LTS_standard_x86_64/x86_64/mimick_vendor/ros-foxy-ros-mimick_vendor-0.2.6-2.oe2203.x86_64.rpm ``` 2. 安装rpm包 aarch64: ``` sudo rpm -ivh --nodeps --force ros-foxy-ros-mimick_vendor-0.2.6-2.oe2203.aarch64.rpm ``` x86_64: ``` sudo rpm -ivh --nodeps --force ros-foxy-ros-mimick_vendor-0.2.6-2.oe2203.x86_64.rpm ``` #### 使用说明 依赖环境安装: ``` sh /opt/ros/foxy/install_dependence.sh ``` 安装完成以后,在/opt/ros/foxy/目录下如下输出,则表示安装成功。 输出: ``` . ├── include │ └── mimick ├── lib │ ├── cmake │ └── libmimick.a └── share ├── ament_index ├── colcon-core └── mimick_vendor ``` 举一个mimic示例程序 `malloc` function: ```c #include #include #include /* Define the blueprint of a mock identified by `malloc_proto` that returns a `void *` and takes a `size_t` parameter. */ mmk_mock_define (malloc_mock, void *, size_t); int main(void) { /* Mock the malloc function in the current module using the `malloc_mock` blueprint. */ mmk_mock("malloc@self", malloc_mock); /* Tell the mock to return NULL and set errno to ENOMEM whatever the given parameter is. */ void *result = NULL; mmk_when(malloc(mmk_any(size_t)), .then_return = &result, .then_errno = ENOMEM); assert(malloc(42) == result && errno == ENOMEM); mmk_reset(malloc); } ``` 另外一种写法: ```c malloc_mock mock = mmk_mock("malloc@self", malloc_mock); void *result = NULL; mmk_when(mock(mmk_any(size_t)), .then_return = &result, .then_errno = ENOMEM); assert(malloc(42) == result && errno == ENOMEM); mmk_reset(mock); ``` #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)