1 Star 0 Fork 0

X.U./cpptest-lite

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

CppTest-lite

Build Status Build Status GitHub license Release

This is an approximate re-implementation of the cpptest testing framework. This library is based on the version 1.1.2.

The original cpptest-framework is not longer in active development and I personally found it too complex for the simple tasks it runs. So I implemented this smaller version in initially around 2 days of work.

CppTest-lite is a lot smaller in size (<200KB compared to >2MB) and runs tests slightly faster.

Compatibility

Runs the test-program of the original cpptest-1.1.2.

Some minor changes were made to the behavior:

  • the macros TEST_ASSERT_EQUALS_OBJ and TEST_ASSERT_EQUALS_OBJ_MSG were disabled (create compiler-error), because they do the exact same thing as TEST_ASSERT_EQUALS and TEST_ASSERT_EQUALS_MSG
  • the macros TEST_THROWS_ANYTHING and TEST_THROWS_ANYTHING_MSG treat throwing any type not extending std::exception as failure, because - seriously - that is bad coding style
  • the add(auto_ptr<Suite>) method was rewritten to use the new shared_ptr.
  • Test::Suite.setup now returns a bool value determining whether to continue running the test-suite
  • Split user-message and failure-message into two separate fields (two separate lines in TextOutput)

New Features (latest version)

  • based upon the (new) C++11 standard
  • new macros TEST_PREDICATE(_MSG) and TEST_BIPREDICATE(_MSG) for testing a single (or two) values with a predicate. Additionally, two new types were created: Test::Predicate and Test::BiPredicate, but basically any method accepting a single (or two) arguments and returning a bool or any other type which can be coerced into a bool can be used.
  • supports parameterized test-methods and multiple registrations for same test-method. The parameters are automatically passed to the test-method and the resulting output
  • added macro TEST_ABORT to fail and abort a test-method
  • added methods to be executed before and after every test-method. setup and before can be used to skip the suite/a single test-method.
  • More detailed failure-message, e.g. prints the failed assertion and the method-parameters, if there are any
  • ParallelSuite allows to run TestSuites in a multi-threaded environment and automatically synchronizes access to the Output.
  • new macros to add tests, TEST_ADD_SINGLE_ARGUMENT, TEST_ADD_TWO_ARGUMENTS and TEST_ADD_TWO_ARGUMENTS to add test with one, two or three arguments of arbitrary types.
  • new macros to compare string-equality TEST_STRING_EQUALS and TEST_STRING_EQUALS_MSG supporting std::string and string-constants.
  • TEST_ASSERT_EQUALS(_MSG) now also supports string equality as well as comparison of NaNs
  • Help-page and selection of test-suites to run can be automatically generated via Test::registerSuite() and Test::runSuites

Behavior driven development

  • As of version 0.6 BDD is supported as a completely new feature
  • write stories and scenarios easily in a text-based style (see TestBDD.h for a few examples)
  • macro-preprocessor automatically generates a Suite for every given Story
The MIT License (MIT) Copyright (c) 2015 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
README
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

4年多前创建了仓库
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xu_wanghao/cpptest-lite.git
git@gitee.com:xu_wanghao/cpptest-lite.git
xu_wanghao
cpptest-lite
cpptest-lite
master

搜索帮助