C++14 單元測試框架:mettle

jopen 10年前發布 | 11K 次閱讀 mettle 單元測試

mettle是一個適用于C++14的單元測試框架。它的目的是最大限度地提高可讀性和清晰度,讓您專注于寫作的測試。

A picture is worth a thousand words, and code's almost as good (I'm sure it's worth at least 100 words), so let's take a look at a test file:

#include <mettle.hpp>
using namespace mettle;

suite<> basic("a basic suite", {

_.test("a test", { expect(true, equal_to(true)); });

for(int i = 0; i < 4; i++) { _.test("test number " + std::to_string(i), i { expect(i % 2, less(2)); }); }

subsuite<>(, "a subsuite", [](auto &) { _.test("a sub-test", { expect(true, equal_to(true)); }); });

});</pre>

項目主頁:http://www.baiduhome.net/lib/view/home/1412072873171

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!