{"id":5841,"date":"2016-02-28T21:41:46","date_gmt":"2016-02-28T12:41:46","guid":{"rendered":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=5841"},"modified":"2016-02-29T16:13:14","modified_gmt":"2016-02-29T07:13:14","slug":"boost-test-%e3%81%ae-data-driven-test-case-%e3%81%a7%e8%8b%a6%e3%81%97%e3%82%80","status":"publish","type":"post","link":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=5841","title":{"rendered":"Boost.Test \u306e data-driven test case \u3067\u82e6\u3057\u3080"},"content":{"rendered":"<p>\u3042\u308b\u95a2\u6570\u3092\u30c6\u30b9\u30c8\u3059\u308b\u6642\u306b\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u304c 1\u306e\u6642\u30012\u306e\u6642\u30013\u306e\u6642\u2026 \u306b\u3064\u3044\u3066\u30c6\u30b9\u30c8\u3057\u305f\u3044\u3001\u3068\u3044\u3046\u5834\u5408\u306b\u3001<\/p>\n<p><!--more--><\/p>\n<blockquote>\n<pre>BOOST_TEST_CASE(hoge_test)\r\n{\r\n    BOOST_CHECK(hoge(1) == 0);\r\n    BOOST_CHECK(hoge(2) == 0);\r\n    BOOST_CHECK(hoge(3) == 0);\r\n}\r\n<\/pre>\n<\/blockquote>\n<p>\u3068\u66f8\u304f\u4ee3\u308f\u308a\u306b<\/p>\n<blockquote>\n<pre>using namespace boost::unit_test;\r\nint param[] = { 1, 2, 3 };\r\nBOOST_DATA_TEST_CASE(hoge_test, data::make(param), i)\r\n{\r\n    BOOST_CHECK(hoge(i) == 0);\r\n}\r\n<\/pre>\n<\/blockquote>\n<p>\u3068\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\uff08Boost 1.59.0 \u4ee5\u964d\u3002\u305d\u308c\u3088\u308a\u524d\u3060\u3068\u9762\u5012\u306a\u7570\u306a\u308b\u66f8\u304d\u65b9\u3092\u3059\u308b\uff09<\/p>\n<p>\u3053\u306e\u4f8b\u3060\u3068\u3042\u307e\u308a\u3054\u5229\u76ca\u304c\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u540c\u3058\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5217\u3092\u5225\u306e\u30c6\u30b9\u30c8\u3067\u3082\u4f7f\u3044\u307e\u308f\u3057\u305f\u3044\u3068\u304b\u3001\u9014\u4e2d\u306b <code>BOOST_REQUIRE<\/code> \u304c\u3042\u308b\uff08\u5931\u6557\u3059\u308b\u3068\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u304c\u305d\u3053\u3067\u7d42\u4e86\u3057\u3066\u3057\u307e\u3046\uff09\u5834\u5408\u3068\u304b\u8003\u3048\u59cb\u3081\u308b\u3068\u5229\u70b9\u304c\u751f\u3058\u307e\u3059\u3002<\/p>\n<p><code>boost::unit_test::data::make<\/code> \u304b\u3089\u8fd4\u3063\u3066\u304f\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092 dataset \u3068\u547c\u3076\u306e\u3067\u3059\u304c\u3001 dataset \u540c\u58eb\u306e\u6f14\u7b97\u304c\u3067\u304d\u3066\u3001<\/p>\n<blockquote>\n<pre>using namespace boost::unit_test;\r\nint param1[] = { 1, 2, 3 };\r\nint param2[] = { 4, 5 };\r\nBOOST_DATA_TEST_CASE(fuga_test, data::make(param1) * data::make(param2), i, j)\r\n{\r\n    BOOST_CHECK(fuga(i, j) == 0);\r\n}\r\n<\/pre>\n<\/blockquote>\n<p>\u3068\u304b\u66f8\u304f\u3068\u3001<code>{ i, j } = { 1, 4 }, { 1, 5 }, { 2, 4 }, { 2, 5 }, { 3, 4 }, { 3, 5 }<\/code> \u306e\u30c6\u30b9\u30c8\u304c\u4e00\u6c17\u306b\u884c\u3048\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u307e\u3067\u524d\u7f6e\u304d\u3002<\/p>\n<p>\u3053\u306e\u6a5f\u80fd\u3001\u4fbf\u5229\u306a\u3093\u3067\u3059\u304c\u3001\u3061\u3087\u3063\u3068\u6b8b\u5ff5\u306a\u3068\u3053\u308d\u3082\u3042\u308a\u307e\u3059\uff08\u4ee5\u4e0b\u3001boost 1.60.0 \u6642\u70b9\u306e\u8a71\uff09<\/p>\n<p>\u307e\u305a\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6570\uff08arity \u3068\u3044\u3046\uff09\u304c3\u307e\u3067\u3067\u3059\u3002\u3064\u307e\u308a\u3001\u4ee5\u4e0b\u306f\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<blockquote>\n<pre>using namespace boost::unit_test;\r\nint param1[] = { 1, 2, 3 };\r\nint param2[] = { 4, 5 };\r\nint param3[] = { 6, 7 };\r\nint param4[] = { 8, 9 };\r\nBOOST_DATA_TEST_CASE(fuga_test, data::make(param1) * data::make(param2) * data::make(param3) * data::make(param4), i, j, k, l)\r\n{\r\n    \/* XXX *\/\r\n}\r\n<\/pre>\n<\/blockquote>\n<p>\u4ee5\u4e0b\u306f arity \u304c 3 \u306a\u306e\u3067\u30bb\u30fc\u30d5\u3067\u3059\u3002<\/p>\n<blockquote>\n<pre>using namespace boost::unit_test;\r\nint param1[] = { 1, 2, 3 };\r\nint param2[] = { 4, 5 };\r\nint param3[] = { 6, 7 };\r\nBOOST_DATA_TEST_CASE(fuga_test, data::make(param1) * data::make(param2) * data::make(param3), i, j, k)\r\n{\r\n    \/* XXX *\/\r\n}\r\n<\/pre>\n<\/blockquote>\n<p>\u307e\u305f\u3001\u6a19\u6e96\u7684\u306b\u63d0\u4f9b\u3055\u308c\u306a\u3044\u3088\u3046\u306a dataset \u306e\u64cd\u4f5c\u3092\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u3059\u3054\u3044\u96e3\u3057\u3044\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<code>data::make<\/code> \u306e\u8fd4\u308a\u5024\u306e\u578b\u306f\u300c\u540c\u3058\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u88c5\u3057\u305f\u30af\u30e9\u30b9\u300d\u3067\u306f\u306a\u304f\u300c\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u540c\u3058\u3088\u3046\u306b\u64cd\u4f5c\u3067\u304d\u308b\u30af\u30e9\u30b9\u300d\uff08\u305f\u3068\u3048\u3070 <code>vector&lt;int&gt;<\/code> \u3068 <code>list&lt;int&gt;<\/code> \u306f\u6d3e\u751f\u95a2\u4fc2\u306f\u7121\u3044\u304c <code>begin<\/code> \u3084 <code>end<\/code> \u306a\u3069\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u540c\u3058\u3088\u3046\u306b\u64cd\u4f5c\u3067\u304d\u308b\uff09\u3067\u3042\u308b\u305f\u3081\u3001\u3053\u308c\u3092\u64cd\u4f5c\u3059\u308b\u3088\u3046\u306a\u51e6\u7406\u3092\u66f8\u3053\u3046\u3068\u3059\u308b\u3068\u3053\u308c\u307e\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u304a\u4e16\u8a71\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u3001<code>{ 1, { a, b } }, { 2, { c, d } }<\/code> \u3068\u3044\u3046 dataset \u3092 <code>{ 1, a }, { 1, b }, { 2, c }, { 2, d }<\/code> \u306b\u5c55\u958b\u3059\u308b\u3088\u3046\u306a\uff08\u6c4e\u7528\u7684\u306a\uff09\u51e6\u7406\u3092\u66f8\u304d\u305f\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u95c7\u306b\u963b\u307e\u308c\u5b9f\u73fe\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002C++ \u96e3\u3057\u3044\u3088\u3002<\/p>\n<p>arity \u304c 3 \u307e\u3067\u306a\u70b9\u306f boost \u306e\u30bd\u30fc\u30b9\u3092\u8aad\u3080\u3068\u5c06\u6765\u4f55\u3068\u304b\u3057\u305f\u3044\u307f\u305f\u3044\u306a\u30b3\u30e1\u30f3\u30c8\u304c\u3042\u308b\u306e\u3067\u671f\u5f85\u3067\u304d\u307e\u3059\u3002dataset \u306e\u64cd\u4f5c\u306e\u65b9\u306f boost \u5074\u304c\u4f55\u3068\u304b\u3057\u3066\u304f\u308c\u308b\u3053\u3068\u306f\u8003\u3048\u3065\u3089\u304f\u3001\u81ea\u5206\u3067\u4f55\u3068\u304b\u3059\u308b\u306b\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u5bfe\u3059\u308b\u6df1\u3044\u7406\u89e3\u304c\u5fc5\u8981\u305d\u3046\u3067\u3001\u3059\u3050\u306b\u306f\u3067\u304d\u305d\u3046\u306b\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3042\u308b\u95a2\u6570\u3092\u30c6\u30b9\u30c8\u3059\u308b\u6642\u306b\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u304c 1\u306e\u6642\u30012\u306e\u6642\u30013\u306e\u6642\u2026 \u306b\u3064\u3044\u3066\u30c6\u30b9\u30c8\u3057\u305f\u3044\u3001\u3068\u3044\u3046\u5834\u5408\u306b\u3001<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-5841","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/5841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5841"}],"version-history":[{"count":12,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/5841\/revisions"}],"predecessor-version":[{"id":5853,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/5841\/revisions\/5853"}],"wp:attachment":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5841"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}