# # # patch "Makefile.am" # from [0cf90540976e43b0705fe0b12938c89600c09b48] # to [f9035e38a9a2f131a3b5baf347b1171a4804fcac] # # patch "charset.cc" # from [72968a86c41c24a69d0fc9f4e6b6ef4a22f3c57d] # to [33ae3508cc1b85b5f89d211897a1d069d8de129c] # # patch "commands.cc" # from [fd6e94498ce70716326673cf532db2ae63945ef5] # to [37c663818da4333a6748e5c7244d97b9625fd0be] # # patch "configure.ac" # from [618d08d5484b8e4a15e464d9e5f41edcad4a2dac] # to [effce38de781662e7868d0de7698df5593692e02] # # patch "crypto_tests.cc" # from [2bcde5c12098bff0bb6a4ea7d906b4cd8d992140] # to [8b029399da90cc38a8ac11f3d0aa058f00111a99] # # patch "cset.cc" # from [0f35a5dc5cfdd76f49eea3276302ee065511ff01] # to [00c69570bb60a3c49337e350ab39816741f6764a] # # patch "dates.cc" # from [30bf4ede576ebc995553f8d464c33dd5f1f97227] # to [5789e3191fc9b2e3db219007aef810dd1d00e9da] # # patch "diff_patch.cc" # from [d4826b42f48007454d5827ae45c9eb39d99dbe6a] # to [2d14a3da45b28431211e62f617620b1af02ab381] # # patch "globish.cc" # from [316d1da34877cb89cb11ea55741be9343c476ff6] # to [9d9680696d2be391787e6697214a544fe955c016] # # patch "keys.cc" # from [c57e3f6a336fcfcd4aec579147269a9ec1a0f279] # to [aec2f1b3cab5149ce6be1db4e771f5d6708b8316] # # patch "m4/boost.m4" # from [38f52769f29b3e6b8b0581df762f4de7cc42c907] # to [e5f267509cb19516efa4424ccbfdee12e47f1911] # # patch "netcmd.cc" # from [f5c66fabed53103434a5e728525b7c8414f6736d] # to [d397060be17a91e9232b83454d59ae0e0ae76146] # # patch "option.cc" # from [9809180c2ab1a052157c0d246bea91b8594c1aae] # to [75b60fa96a8aefab50c6b0a1a16b255bf40b9933] # # patch "outdated_indicator.cc" # from [317f240d2e417e8465461d5ac9afe4cdb889d05f] # to [f1b81dda2764ff8a6bae829ec88e68cde1f8b580] # # patch "packet.cc" # from [991e6a99aeb8e43d48d09d64b22e080bb617f08f] # to [98bc3698868eba6ee9e1a5fbe65b56f38cf4e6cd] # # patch "paths.cc" # from [0b81dfd4a65442de417c635cd8f003994af44ee1] # to [1bf8148ef65b40754d726c9d047093e83a8c042b] # # patch "refiner.cc" # from [c4bacfb1eadaa252c39136468356585bdeebcc77] # to [c0ce0399c404b5463a7e9952fd063f0c55b89f21] # # patch "restrictions.cc" # from [3b059a0327f0bea5958a1eecfb2bbe9a3c525e10] # to [9c67575a229df8b944b5da5a7a6721c40588f92d] # # patch "rev_height.cc" # from [f44979ce3c7ba571c00cf0c810991aec9f7f84fa] # to [a44fcd6a6619cd1b8b187674abdd07793f146023] # # patch "roster.cc" # from [dfb22c69788162515c92abc16b52eee9c1e4f75e] # to [48b29599a42af23853120572d56068ac1ebfd6fc] # # patch "simplestring_xform.cc" # from [3e052a16b5e80bbc6d44580577879566ff284188] # to [eb98a7a93a9593dcf13ae3cb9200e4ad9a3b6267] # # patch "string_queue.cc" # from [efa027721a9185785b0e59e74b09e5e6c9ea9054] # to [3c8ba74dc7770c6fd3e6f8934190d097338a238f] # # patch "transforms.cc" # from [11205cfd44465baf2003bea2cb1643c0af6555ad] # to [a6e23fbd561ca7ed18e71908e3829e29b0c94c5b] # # patch "unit_tests.cc" # from [b7e283d0d3ca3a50906641adcbf2ba656050030f] # to [cf96c37f99db8ef8d69df5ab1a77e8789a126ac9] # # patch "unit_tests.hh" # from [54c36f029f54f507a7ec69e197161be527ef8f33] # to [0c622d45cff9c8fbf892546113c4e5aefe0b2a6c] # # patch "uri.cc" # from [72edc51b298f51cac2c9b431ac72e5987f6d53f9] # to [3fd42bc9b1453ba09c349a8b9561831e7d37d6c6] # # patch "vocab.cc" # from [842d7558aa658249160db34543481792f4a7a081] # to [9e7e99b5b2e0088d4b2e2f41b0cb0682fb2024c0] # # patch "xdelta.cc" # from [3f7317d83d21a7eb42f14d1fbac55e795b28dbe6] # to [62598b3546340ead92754e868ac579292550a32a] # ============================================================ --- Makefile.am 0cf90540976e43b0705fe0b12938c89600c09b48 +++ Makefile.am f9035e38a9a2f131a3b5baf347b1171a4804fcac @@ -362,7 +362,7 @@ unit_tests_CXXFLAGS = $(AM_CXXFLAGS) $(P unit_tests_CPPFLAGS = -DBUILD_UNIT_TESTS -I$(top_srcdir)/lua \ -I$(top_srcdir)/sqlite unit_tests_CXXFLAGS = $(AM_CXXFLAGS) $(PCH_FLAGS) -unit_tests_LDADD = lib3rdparty.a $(BOOSTLIBS) $(BOOST_UNITTEST) \ +unit_tests_LDADD = lib3rdparty.a $(BOOSTLIBS) \ libplatform.a $(LIBICONV) $(LIBINTL) tester_LDFLAGS = @@ -500,18 +500,11 @@ monotone-$(PACKAGE_VERSION).dmg: monoton # testsuite stuff (could this possibly be more ugly?) -if BUILD_UNIT_TESTS check_PROGRAMS = unit_tests tester TESTS = unit_tests run_tester_tests run_lua_tests -else -check_PROGRAMS = tester -TESTS = run_tester_tests run_lua_tests - -endif - TESTS_ENVIRONMENT=AUTOTEST_PATH="." mostlyclean-local: ============================================================ --- charset.cc 72968a86c41c24a69d0fc9f4e6b6ef4a22f3c57d +++ charset.cc 33ae3508cc1b85b5f89d211897a1d069d8de129c @@ -620,7 +620,7 @@ UNIT_TEST(charset, idna_encoding) for (size_t i = 0; i < sizeof(idna_vec) / sizeof(struct idna); ++i) { - BOOST_CHECKPOINT("IDNA language: " + string(idna_vec[i].name)); + UNIT_TEST_CHECKPOINT("IDNA language: " + string(idna_vec[i].name)); size_t p, q; char *uc = stringprep_ucs4_to_utf8(idna_vec[i].in, @@ -634,9 +634,9 @@ UNIT_TEST(charset, idna_encoding) ace tace; utf8_to_ace(utf, tace); L(FL("ACE-encoded %s: '%s'") % idna_vec[i].name % tace()); - BOOST_CHECK(lowercase(a()) == lowercase(tace())); + UNIT_TEST_CHECK(lowercase(a()) == lowercase(tace())); ace_to_utf8(a, tutf); - BOOST_CHECK(lowercase(utf()) == lowercase(tutf())); + UNIT_TEST_CHECK(lowercase(utf()) == lowercase(tutf())); } } @@ -857,10 +857,10 @@ UNIT_TEST(charset, utf8_validation) }; for (int i = 0; good_strings[i]; ++i) - BOOST_CHECK(utf8_validate(utf8(good_strings[i])) == true); + UNIT_TEST_CHECK(utf8_validate(utf8(good_strings[i])) == true); for (int i = 0; bad_strings[i]; ++i) - BOOST_CHECK(utf8_validate(utf8(bad_strings[i])) == false); + UNIT_TEST_CHECK(utf8_validate(utf8(bad_strings[i])) == false); } #endif // BUILD_UNIT_TESTS ============================================================ --- commands.cc fd6e94498ce70716326673cf532db2ae63945ef5 +++ commands.cc 37c663818da4333a6748e5c7244d97b9625fd0be @@ -940,15 +940,15 @@ UNIT_TEST(commands, make_command_id) { command_id id = make_command_id("foo"); - BOOST_CHECK(id.size() == 1); - BOOST_CHECK(id[0]() == "foo"); + UNIT_TEST_CHECK(id.size() == 1); + UNIT_TEST_CHECK(id[0]() == "foo"); } { command_id id = make_command_id("foo bar"); - BOOST_CHECK(id.size() == 2); - BOOST_CHECK(id[0]() == "foo"); - BOOST_CHECK(id[1]() == "bar"); + UNIT_TEST_CHECK(id.size() == 2); + UNIT_TEST_CHECK(id[0]() == "foo"); + UNIT_TEST_CHECK(id[1]() == "bar"); } } @@ -961,31 +961,31 @@ UNIT_TEST(commands, complete_command) // Single-word identifier, top-level category. { command_id id = complete_command(mkargs("top")); - BOOST_CHECK(id == make_command_id("top")); + UNIT_TEST_CHECK(id == make_command_id("top")); } // Single-word identifier. { command_id id = complete_command(mkargs("testg")); - BOOST_CHECK(id == make_command_id("top testg")); + UNIT_TEST_CHECK(id == make_command_id("top testg")); } // Single-word identifier, non-primary name. { command_id id = complete_command(mkargs("alias1")); - BOOST_CHECK(id == make_command_id("top alias1")); + UNIT_TEST_CHECK(id == make_command_id("top alias1")); } // Multi-word identifier. { command_id id = complete_command(mkargs("testg testg1")); - BOOST_CHECK(id == make_command_id("top testg testg1")); + UNIT_TEST_CHECK(id == make_command_id("top testg testg1")); } // Multi-word identifier, non-primary names. { command_id id = complete_command(mkargs("al testg1")); - BOOST_CHECK(id == make_command_id("top aliasg testg1")); + UNIT_TEST_CHECK(id == make_command_id("top aliasg testg1")); } } @@ -998,103 +998,103 @@ UNIT_TEST(commands, command_complete_com { command_id id = make_command_id("foo"); set< command_id > matches = CMD_REF(top)->complete_command(id); - BOOST_REQUIRE(matches.size() == 0); + UNIT_TEST_REQUIRE(matches.size() == 0); } // Non-existent multi-word identifier. { command_id id = make_command_id("foo bar"); set< command_id > matches = CMD_REF(top)->complete_command(id); - BOOST_REQUIRE(matches.size() == 0); + UNIT_TEST_REQUIRE(matches.size() == 0); } // Single-word identifier with one match. { command_id id = make_command_id("test1"); set< command_id > matches = CMD_REF(top)->complete_command(id); - BOOST_REQUIRE(matches.size() == 1); - BOOST_CHECK(*matches.begin() == make_command_id("test1")); + UNIT_TEST_REQUIRE(matches.size() == 1); + UNIT_TEST_CHECK(*matches.begin() == make_command_id("test1")); } // Single-word identifier with one match, non-primary name. { command_id id = make_command_id("alias1"); set< command_id > matches = CMD_REF(top)->complete_command(id); - BOOST_REQUIRE(matches.size() == 1); - BOOST_CHECK(*matches.begin() == make_command_id("alias1")); + UNIT_TEST_REQUIRE(matches.size() == 1); + UNIT_TEST_CHECK(*matches.begin() == make_command_id("alias1")); } // Single-word identifier with multiple matches. { command_id id = make_command_id("test"); set< command_id > matches = CMD_REF(top)->complete_command(id); - BOOST_REQUIRE(matches.size() == 3); + UNIT_TEST_REQUIRE(matches.size() == 3); set< command_id > expected; expected.insert(make_command_id("test1")); expected.insert(make_command_id("test2")); expected.insert(make_command_id("testg")); - BOOST_CHECK(matches == expected); + UNIT_TEST_CHECK(matches == expected); } // Single-word identifier with multiple matches, non-primary name. { command_id id = make_command_id("alias"); set< command_id > matches = CMD_REF(top)->complete_command(id); - BOOST_REQUIRE(matches.size() == 3); + UNIT_TEST_REQUIRE(matches.size() == 3); set< command_id > expected; expected.insert(make_command_id("alias1")); expected.insert(make_command_id("alias2")); expected.insert(make_command_id("aliasg")); - BOOST_CHECK(matches == expected); + UNIT_TEST_CHECK(matches == expected); } // Multi-word identifier with one match. { command_id id = make_command_id("testg testg1"); set< command_id > matches = CMD_REF(top)->complete_command(id); - BOOST_REQUIRE(matches.size() == 1); + UNIT_TEST_REQUIRE(matches.size() == 1); set< command_id > expected; expected.insert(make_command_id("testg testg1")); - BOOST_CHECK(matches == expected); + UNIT_TEST_CHECK(matches == expected); } // Multi-word identifier with multiple matches. { command_id id = make_command_id("testg testg"); set< command_id > matches = CMD_REF(top)->complete_command(id); - BOOST_REQUIRE(matches.size() == 2); + UNIT_TEST_REQUIRE(matches.size() == 2); set< command_id > expected; expected.insert(make_command_id("testg testg1")); expected.insert(make_command_id("testg testg2")); - BOOST_CHECK(matches == expected); + UNIT_TEST_CHECK(matches == expected); } // Multi-word identifier with multiple matches at different levels. { command_id id = make_command_id("test testg1"); set< command_id > matches = CMD_REF(top)->complete_command(id); - BOOST_REQUIRE(matches.size() == 3); + UNIT_TEST_REQUIRE(matches.size() == 3); set< command_id > expected; expected.insert(make_command_id("test1")); expected.insert(make_command_id("test2")); expected.insert(make_command_id("testg testg1")); - BOOST_CHECK(matches == expected); + UNIT_TEST_CHECK(matches == expected); } // Multi-word identifier with one match and extra words. { command_id id = make_command_id("testg testg1 foo"); set< command_id > matches = CMD_REF(top)->complete_command(id); - BOOST_REQUIRE(matches.size() == 1); + UNIT_TEST_REQUIRE(matches.size() == 1); set< command_id > expected; expected.insert(make_command_id("testg testg1")); - BOOST_CHECK(matches == expected); + UNIT_TEST_CHECK(matches == expected); } } @@ -1108,63 +1108,63 @@ UNIT_TEST(commands, command_find_command { command_id id = make_command_id("foo"); command * cmd = CMD_REF(top)->find_command(id); - BOOST_CHECK(cmd == NULL); + UNIT_TEST_CHECK(cmd == NULL); } // Non-existent multi-word identifier. { command_id id = make_command_id("foo bar"); command * cmd = CMD_REF(top)->find_command(id); - BOOST_CHECK(cmd == NULL); + UNIT_TEST_CHECK(cmd == NULL); } // Single-word identifier that could be completed. { command_id id = make_command_id("test"); command * cmd = CMD_REF(top)->find_command(id); - BOOST_CHECK(cmd == NULL); + UNIT_TEST_CHECK(cmd == NULL); } // Single-word identifier. { command_id id = make_command_id("test1"); command * cmd = CMD_REF(top)->find_command(id); - BOOST_CHECK(cmd == CMD_REF(test1)); + UNIT_TEST_CHECK(cmd == CMD_REF(test1)); } // Hidden single-word identifier. { command_id id = make_command_id("test3"); command * cmd = CMD_REF(top)->find_command(id); - BOOST_CHECK(cmd == CMD_REF(test3)); + UNIT_TEST_CHECK(cmd == CMD_REF(test3)); } // Multi-word identifier that could be completed. { command_id id = make_command_id("testg testg"); command * cmd = CMD_REF(top)->find_command(id); - BOOST_CHECK(cmd == NULL); + UNIT_TEST_CHECK(cmd == NULL); } // Multi-word identifier. { command_id id = make_command_id("testg testg1"); command * cmd = CMD_REF(top)->find_command(id); - BOOST_CHECK(cmd == CMD_REF(testg1)); + UNIT_TEST_CHECK(cmd == CMD_REF(testg1)); } // Hidden multi-word identifier. { command_id id = make_command_id("testg testg3"); command * cmd = CMD_REF(top)->find_command(id); - BOOST_CHECK(cmd == CMD_REF(testg3)); + UNIT_TEST_CHECK(cmd == CMD_REF(testg3)); } // Multi-word identifier with extra words. { command_id id = make_command_id("testg testg1 foo"); command * cmd = CMD_REF(top)->find_command(id); - BOOST_CHECK(cmd == NULL); + UNIT_TEST_CHECK(cmd == NULL); } } #endif // BUILD_UNIT_TESTS ============================================================ --- configure.ac 618d08d5484b8e4a15e464d9e5f41edcad4a2dac +++ configure.ac effce38de781662e7868d0de7698df5593692e02 @@ -129,7 +129,6 @@ MTN_BOOST_LIB_REGEX MTN_BOOST_LIB_FILESYSTEM MTN_BOOST_LIB_REGEX -MTN_BOOST_LIB_UNIT_TEST_FRAMEWORK # more complex library checks MTN_NETXX_DEPENDENCIES ============================================================ --- crypto_tests.cc 2bcde5c12098bff0bb6a4ea7d906b4cd8d992140 +++ crypto_tests.cc 8b029399da90cc38a8ac11f3d0aa058f00111a99 @@ -1064,7 +1064,7 @@ UNIT_TEST(crypto, calculate_ident) //L(FL(" Input: %s") % input); //L(FL("Output: %s") % output); - BOOST_CHECK(output() == ident); + UNIT_TEST_CHECK(output() == ident); L(FL("SHA Short Message Test: Passed\n\n")); @@ -1114,7 +1114,7 @@ UNIT_TEST(crypto, calculate_ident) L(FL(" %03d: %s") % j % output2 ); - BOOST_CHECK(output2() == expected_SHA_MCT[j]); + UNIT_TEST_CHECK(output2() == expected_SHA_MCT[j]); MD[j] = output2(); Seed = MD[j]; ============================================================ --- cset.cc 0f35a5dc5cfdd76f49eea3276302ee065511ff01 +++ cset.cc 00c69570bb60a3c49337e350ab39816741f6764a @@ -519,14 +519,14 @@ UNIT_TEST(cset, cset_written) "add_dir \"pling\"\n"); data d1(s); cset cs; - BOOST_CHECK_THROW(read_cset(d1, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(d1, cs), logic_error); // check that it still fails if there's extra stanzas past the // mis-ordered entries data d2(s + "\n" " set \"bar\"\n" " attr \"flavoursome\"\n" "value \"mostly\"\n"); - BOOST_CHECK_THROW(read_cset(d2, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(d2, cs), logic_error); } { @@ -536,7 +536,7 @@ UNIT_TEST(cset, cset_written) "\n" "delete \"bar\"\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -548,7 +548,7 @@ UNIT_TEST(cset, cset_written) "rename \"bar\"\n" " to \"barnew\"\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -558,7 +558,7 @@ UNIT_TEST(cset, cset_written) "\n" "add_dir \"bar\"\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -570,7 +570,7 @@ UNIT_TEST(cset, cset_written) "add_file \"bar\"\n" " content [0000000000000000000000000000000000000000]\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -582,7 +582,7 @@ UNIT_TEST(cset, cset_written) "add_file \"bar\"\n" " content [0000000000000000000000000000000000000000]\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -596,7 +596,7 @@ UNIT_TEST(cset, cset_written) " from [0000000000000000000000000000000000000000]\n" " to [1000000000000000000000000000000000000000]\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -608,7 +608,7 @@ UNIT_TEST(cset, cset_written) "clear \"bar\"\n" " attr \"flavoursome\"\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -622,7 +622,7 @@ UNIT_TEST(cset, cset_written) " attr \"flavoursome\"\n" "value \"yes\"\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -631,7 +631,7 @@ UNIT_TEST(cset, cset_written) "\n" "delete \"foo\"\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -645,7 +645,7 @@ UNIT_TEST(cset, cset_written) " attr \"smell\"\n" "value \"socks\"\n"); cset cs; - BOOST_CHECK_NOT_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_NOT_THROW(read_cset(dat, cs), logic_error); } { @@ -657,7 +657,7 @@ UNIT_TEST(cset, cset_written) "clear \"bar\"\n" " attr \"fooish\"\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -671,7 +671,7 @@ UNIT_TEST(cset, cset_written) " attr \"fooish\"\n" "value \"seldom\"\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -685,7 +685,7 @@ UNIT_TEST(cset, cset_written) " attr \"flavoursome\"\n" "value \"sometimes\"\n"); cset cs; - BOOST_CHECK_THROW(read_cset(dat, cs), logic_error); + UNIT_TEST_CHECK_THROW(read_cset(dat, cs), logic_error); } { @@ -750,7 +750,7 @@ UNIT_TEST(cset, cset_written) ); MM(expected); // I() so that it'll dump on failure - BOOST_CHECK_NOT_THROW(I(expected == dat), logic_error); + UNIT_TEST_CHECK_NOT_THROW(I(expected == dat), logic_error); } } @@ -779,10 +779,10 @@ UNIT_TEST(cset, basic_csets) setup_roster(r, f1, nis); cset cs; MM(cs); cs.files_added.insert(make_pair(baz, f2)); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK(is_file_t(r.get_node(baz))); - BOOST_CHECK(downcast_to_file_t(r.get_node(baz))->content == f2); - BOOST_CHECK(r.all_nodes().size() == 4); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK(is_file_t(r.get_node(baz))); + UNIT_TEST_CHECK(downcast_to_file_t(r.get_node(baz))->content == f2); + UNIT_TEST_CHECK(r.all_nodes().size() == 4); } { @@ -790,9 +790,9 @@ UNIT_TEST(cset, basic_csets) setup_roster(r, f1, nis); cset cs; MM(cs); cs.dirs_added.insert(quux); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK(is_dir_t(r.get_node(quux))); - BOOST_CHECK(r.all_nodes().size() == 4); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK(is_dir_t(r.get_node(quux))); + UNIT_TEST_CHECK(r.all_nodes().size() == 4); } { @@ -801,8 +801,8 @@ UNIT_TEST(cset, basic_csets) cset cs; MM(cs); cs.nodes_deleted.insert(foo_bar); cs.nodes_deleted.insert(foo); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK(r.all_nodes().size() == 1); // only the root left + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK(r.all_nodes().size() == 1); // only the root left } { @@ -810,11 +810,11 @@ UNIT_TEST(cset, basic_csets) setup_roster(r, f1, nis); cset cs; MM(cs); cs.nodes_renamed.insert(make_pair(foo_bar, quux)); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK(is_file_t(r.get_node(quux))); - BOOST_CHECK(is_dir_t(r.get_node(foo))); - BOOST_CHECK(!r.has_node(foo_bar)); - BOOST_CHECK(r.all_nodes().size() == 3); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK(is_file_t(r.get_node(quux))); + UNIT_TEST_CHECK(is_dir_t(r.get_node(foo))); + UNIT_TEST_CHECK(!r.has_node(foo_bar)); + UNIT_TEST_CHECK(r.all_nodes().size() == 3); } { @@ -824,11 +824,11 @@ UNIT_TEST(cset, basic_csets) setup_roster(r, f1, nis); cset cs; MM(cs); cs.nodes_renamed.insert(make_pair(foo, quux)); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK(is_dir_t(r.get_node(quux))); - BOOST_CHECK(is_file_t(r.get_node(quux_bar))); - BOOST_CHECK(!r.has_node(foo)); - BOOST_CHECK(r.all_nodes().size() == 3); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK(is_dir_t(r.get_node(quux))); + UNIT_TEST_CHECK(is_file_t(r.get_node(quux_bar))); + UNIT_TEST_CHECK(!r.has_node(foo)); + UNIT_TEST_CHECK(r.all_nodes().size() == 3); } { @@ -836,11 +836,11 @@ UNIT_TEST(cset, basic_csets) setup_roster(r, f1, nis); cset cs; MM(cs); cs.deltas_applied.insert(make_pair(foo_bar, make_pair(f1, f2))); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK(is_dir_t(r.get_node(foo))); - BOOST_CHECK(is_file_t(r.get_node(foo_bar))); - BOOST_CHECK(downcast_to_file_t(r.get_node(foo_bar))->content == f2); - BOOST_CHECK(r.all_nodes().size() == 3); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK(is_dir_t(r.get_node(foo))); + UNIT_TEST_CHECK(is_file_t(r.get_node(foo_bar))); + UNIT_TEST_CHECK(downcast_to_file_t(r.get_node(foo_bar))->content == f2); + UNIT_TEST_CHECK(r.all_nodes().size() == 3); } { @@ -849,15 +849,15 @@ UNIT_TEST(cset, basic_csets) cset cs; MM(cs); cs.attrs_set.insert(make_pair(make_pair(foo_bar, attr_key("ping")), attr_value("klang"))); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); full_attr_map_t attrs = (r.get_node(foo_bar))->attrs; - BOOST_CHECK(attrs[attr_key("ping")] == make_pair(true, attr_value("klang"))); + UNIT_TEST_CHECK(attrs[attr_key("ping")] == make_pair(true, attr_value("klang"))); attrs = (r.get_node(foo))->attrs; - BOOST_CHECK(attrs[attr_key("attr_dir")] == make_pair(true, attr_value("value_dir"))); + UNIT_TEST_CHECK(attrs[attr_key("attr_dir")] == make_pair(true, attr_value("value_dir"))); - BOOST_CHECK(r.all_nodes().size() == 3); + UNIT_TEST_CHECK(r.all_nodes().size() == 3); } { @@ -867,10 +867,10 @@ UNIT_TEST(cset, basic_csets) cs.attrs_set.insert(make_pair(make_pair(foo_bar, attr_key("ping")), attr_value("klang"))); cs.attrs_cleared.insert(make_pair(foo_bar, attr_key("attr_file"))); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK((r.get_node(foo_bar))->attrs[attr_key("attr_file")] + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK((r.get_node(foo_bar))->attrs[attr_key("attr_file")] == make_pair(false, attr_value(""))); - BOOST_CHECK(r.all_nodes().size() == 3); + UNIT_TEST_CHECK(r.all_nodes().size() == 3); } // some renaming tests @@ -897,8 +897,8 @@ UNIT_TEST(cset, basic_csets) cs.dirs_added.insert(foo_sub); cs.files_added.insert(make_pair(foo_sub_deep, f2)); cs.files_added.insert(make_pair(quux_sub_thing, f1)); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK(r.all_nodes().size() == 8); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK(r.all_nodes().size() == 8); } { // some renames @@ -906,21 +906,21 @@ UNIT_TEST(cset, basic_csets) cs.nodes_renamed.insert(make_pair(foo, quux)); cs.nodes_renamed.insert(make_pair(quux, foo)); cs.nodes_renamed.insert(make_pair(foo_sub, foo_subsub)); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); } - BOOST_CHECK(r.all_nodes().size() == 8); + UNIT_TEST_CHECK(r.all_nodes().size() == 8); // /foo/bar -> /quux/bar - BOOST_CHECK(is_file_t(r.get_node(quux_bar))); - BOOST_CHECK(!(r.has_node(foo_bar))); + UNIT_TEST_CHECK(is_file_t(r.get_node(quux_bar))); + UNIT_TEST_CHECK(!(r.has_node(foo_bar))); // /foo/sub/deep -> /foo/subsub/deep - BOOST_CHECK(is_file_t(r.get_node(foo_subsub_deep))); - BOOST_CHECK(!(r.has_node(foo_sub_deep))); + UNIT_TEST_CHECK(is_file_t(r.get_node(foo_subsub_deep))); + UNIT_TEST_CHECK(!(r.has_node(foo_sub_deep))); // /quux/sub -> /foo/sub - BOOST_CHECK(is_dir_t(r.get_node(foo_sub))); - BOOST_CHECK(!(r.has_node(quux_sub))); + UNIT_TEST_CHECK(is_dir_t(r.get_node(foo_sub))); + UNIT_TEST_CHECK(!(r.has_node(quux_sub))); // /quux/sub/thing -> /foo/sub/thing - BOOST_CHECK(is_file_t(r.get_node(foo_sub_thing))); + UNIT_TEST_CHECK(is_file_t(r.get_node(foo_sub_thing))); } { @@ -929,9 +929,9 @@ UNIT_TEST(cset, basic_csets) cset cs; MM(cs); cs.nodes_renamed.insert(make_pair(foo_bar, foo)); cs.nodes_deleted.insert(foo); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK(r.all_nodes().size() == 2); - BOOST_CHECK(is_file_t(r.get_node(foo))); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK(r.all_nodes().size() == 2); + UNIT_TEST_CHECK(is_file_t(r.get_node(foo))); } } @@ -957,23 +957,23 @@ UNIT_TEST(cset, invalid_csets) setup_roster(r, f1, nis); cset cs; MM(cs); cs.nodes_deleted.insert(foo_bar); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't double-add file")); setup_roster(r, f1, nis); cset cs; MM(cs); cs.files_added.insert(make_pair(baz, f2)); - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't add file on top of dir")); setup_roster(r, f1, nis); cset cs; MM(cs); cs.files_added.insert(make_pair(foo, f2)); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't delete+rename")); @@ -981,7 +981,7 @@ UNIT_TEST(cset, invalid_csets) cset cs; MM(cs); cs.nodes_deleted.insert(foo_bar); cs.nodes_renamed.insert(make_pair(foo_bar, baz)); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't add+rename")); @@ -989,28 +989,28 @@ UNIT_TEST(cset, invalid_csets) cset cs; MM(cs); cs.dirs_added.insert(baz); cs.nodes_renamed.insert(make_pair(baz, quux)); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't add on top of root dir")); setup_roster(r, f1, nis); cset cs; MM(cs); cs.dirs_added.insert(root); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't rename on top of root dir")); setup_roster(r, f1, nis); cset cs; MM(cs); cs.nodes_renamed.insert(make_pair(foo, root)); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't rename 'a' 'a'")); setup_roster(r, f1, nis); cset cs; MM(cs); cs.nodes_renamed.insert(make_pair(foo_bar, foo_bar)); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't rename 'a' 'b'; rename 'a/foo' 'b/foo'")); @@ -1020,7 +1020,7 @@ UNIT_TEST(cset, invalid_csets) file_path_internal("baz/bar").split(baz_bar); cs.nodes_renamed.insert(make_pair(foo, baz)); cs.nodes_renamed.insert(make_pair(foo_bar, baz_bar)); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't attr_set + attr_cleared")); @@ -1029,7 +1029,7 @@ UNIT_TEST(cset, invalid_csets) cs.attrs_set.insert(make_pair(make_pair(foo_bar, attr_key("blah")), attr_value("blahblah"))); cs.attrs_cleared.insert(make_pair(foo_bar, attr_key("blah"))); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't no-op attr_set")); @@ -1037,14 +1037,14 @@ UNIT_TEST(cset, invalid_csets) cset cs; MM(cs); cs.attrs_set.insert(make_pair(make_pair(foo_bar, attr_key("attr_file")), attr_value("value_file"))); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't clear non-existent attr")); setup_roster(r, f1, nis); cset cs; MM(cs); cs.attrs_cleared.insert(make_pair(foo_bar, attr_key("blah"))); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't clear non-existent attr that once existed")); @@ -1052,9 +1052,9 @@ UNIT_TEST(cset, invalid_csets) cset cs; MM(cs); cs.attrs_cleared.insert(make_pair(foo_bar, attr_key("attr_file"))); // exists now, so should be fine - BOOST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_NOT_THROW(cs.apply_to(tree), logic_error); // but last time killed it, so can't be killed again - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't have no-op deltas")); @@ -1062,7 +1062,7 @@ UNIT_TEST(cset, invalid_csets) cset cs; MM(cs); cs.deltas_applied.insert(make_pair(foo_bar, make_pair(f1, f1))); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't have add+delta")); @@ -1071,7 +1071,7 @@ UNIT_TEST(cset, invalid_csets) cs.files_added.insert(make_pair(baz, f1)); cs.deltas_applied.insert(make_pair(baz, make_pair(f1, f2))); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't delta a directory")); @@ -1079,14 +1079,14 @@ UNIT_TEST(cset, invalid_csets) cset cs; MM(cs); cs.deltas_applied.insert(make_pair(foo, make_pair(f1, f2))); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't delete non-empty directory")); setup_roster(r, f1, nis); cset cs; MM(cs); cs.nodes_deleted.insert(foo); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: attach node with no root directory present")); @@ -1096,7 +1096,7 @@ UNIT_TEST(cset, invalid_csets) split_path sp; file_path_internal("blah/blah/blah").split(sp); cs.dirs_added.insert(sp); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } { L(FL("TEST: can't move a directory underneath itself")); @@ -1105,7 +1105,7 @@ UNIT_TEST(cset, invalid_csets) split_path foo_blah; file_path_internal("foo/blah").split(foo_blah); cs.nodes_renamed.insert(make_pair(foo, foo_blah)); - BOOST_CHECK_THROW(cs.apply_to(tree), logic_error); + UNIT_TEST_CHECK_THROW(cs.apply_to(tree), logic_error); } } @@ -1140,7 +1140,7 @@ UNIT_TEST(cset, root_dir) cset cs; MM(cs); cs.nodes_deleted.insert(root); cs.apply_to(tree); - BOOST_CHECK_THROW(r.check_sane(true), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane(true), logic_error); } { L(FL("TEST: can delete and replace root")); ============================================================ --- dates.cc 30bf4ede576ebc995553f8d464c33dd5f1f97227 +++ dates.cc 5789e3191fc9b2e3db219007aef810dd1d00e9da @@ -336,9 +336,9 @@ UNIT_TEST(date, from_string) UNIT_TEST(date, from_string) { -#define OK(x,y) BOOST_CHECK(date_t::from_string(x).as_iso_8601_extended() \ +#define OK(x,y) UNIT_TEST_CHECK(date_t::from_string(x).as_iso_8601_extended() \ == (y)) -#define NO(x) BOOST_CHECK_THROW(date_t::from_string(x), informative_failure) +#define NO(x) UNIT_TEST_CHECK_THROW(date_t::from_string(x), informative_failure) // canonical format OK("2007-03-01T18:41:13", "2007-03-01T18:41:13"); @@ -437,7 +437,7 @@ UNIT_TEST(date, from_unix_epoch) #define OK(x,y) do { \ string s_ = date_t::from_unix_epoch(x).as_iso_8601_extended(); \ L(FL("from_unix_epoch: %lu -> %s") % (x) % s_); \ - BOOST_CHECK(s_ == (y)); \ + UNIT_TEST_CHECK(s_ == (y)); \ } while (0) // every month boundary in 1970 @@ -551,7 +551,7 @@ UNIT_TEST(date, from_unix_epoch) // limit of a (signed) 32-bit year counter OK(u64_C(67767976233532799), "2147483647-12-31T23:59:59"); - BOOST_CHECK_THROW(date_t::from_unix_epoch(u64_C(67768036191676800)), + UNIT_TEST_CHECK_THROW(date_t::from_unix_epoch(u64_C(67768036191676800)), std::logic_error); #undef OK ============================================================ --- diff_patch.cc d4826b42f48007454d5827ae45c9eb39d99dbe6a +++ diff_patch.cc 2d14a3da45b28431211e62f617620b1af02ab381 @@ -1396,15 +1396,15 @@ UNIT_TEST(diff_patch, randomizing_merge) file_randomizer::build_random_fork(anc, d1, d2, gm, (10 + 2 * i), rng); - BOOST_CHECK(merge3(anc, d1, d2, m1)); + UNIT_TEST_CHECK(merge3(anc, d1, d2, m1)); if (gm != m1) dump_incorrect_merge (gm, m1, "random_merge 1"); - BOOST_CHECK(gm == m1); + UNIT_TEST_CHECK(gm == m1); - BOOST_CHECK(merge3(anc, d2, d1, m2)); + UNIT_TEST_CHECK(merge3(anc, d2, d1, m2)); if (gm != m2) dump_incorrect_merge (gm, m2, "random_merge 2"); - BOOST_CHECK(gm == m2); + UNIT_TEST_CHECK(gm == m2); } } @@ -1412,7 +1412,7 @@ UNIT_TEST(diff_patch, merge_prepend) // old boring tests UNIT_TEST(diff_patch, merge_prepend) { - BOOST_CHECKPOINT("prepend test"); + UNIT_TEST_CHECKPOINT("prepend test"); vector anc, d1, d2, m1, m2, gm; for (int i = 10; i < 20; ++i) { @@ -1428,21 +1428,21 @@ UNIT_TEST(diff_patch, merge_prepend) gm.push_back(lexical_cast(i)); } - BOOST_CHECK(merge3(anc, d1, d2, m1)); + UNIT_TEST_CHECK(merge3(anc, d1, d2, m1)); if (gm != m1) dump_incorrect_merge (gm, m1, "merge_prepend 1"); - BOOST_CHECK(gm == m1); + UNIT_TEST_CHECK(gm == m1); - BOOST_CHECK(merge3(anc, d2, d1, m2)); + UNIT_TEST_CHECK(merge3(anc, d2, d1, m2)); if (gm != m2) dump_incorrect_merge (gm, m2, "merge_prepend 2"); - BOOST_CHECK(gm == m2); + UNIT_TEST_CHECK(gm == m2); } UNIT_TEST(diff_patch, merge_append) { - BOOST_CHECKPOINT("append test"); + UNIT_TEST_CHECKPOINT("append test"); vector anc, d1, d2, m1, m2, gm; for (int i = 0; i < 10; ++i) anc.push_back(lexical_cast(i)); @@ -1457,22 +1457,22 @@ UNIT_TEST(diff_patch, merge_append) gm.push_back(lexical_cast(i)); } - BOOST_CHECK(merge3(anc, d1, d2, m1)); + UNIT_TEST_CHECK(merge3(anc, d1, d2, m1)); if (gm != m1) dump_incorrect_merge (gm, m1, "merge_append 1"); - BOOST_CHECK(gm == m1); + UNIT_TEST_CHECK(gm == m1); - BOOST_CHECK(merge3(anc, d2, d1, m2)); + UNIT_TEST_CHECK(merge3(anc, d2, d1, m2)); if (gm != m2) dump_incorrect_merge (gm, m2, "merge_append 2"); - BOOST_CHECK(gm == m2); + UNIT_TEST_CHECK(gm == m2); } UNIT_TEST(diff_patch, merge_additions) { - BOOST_CHECKPOINT("additions test"); + UNIT_TEST_CHECKPOINT("additions test"); string ancestor("I like oatmeal\nI like orange juice\nI like toast"); string desc1("I like oatmeal\nI don't like spam\nI like orange juice\nI like toast"); string confl("I like oatmeal\nI don't like tuna\nI like orange juice\nI like toast"); @@ -1486,17 +1486,17 @@ UNIT_TEST(diff_patch, merge_additions) split_into_lines(desc2, d2); split_into_lines(good_merge, gm); - BOOST_CHECK(merge3(anc, d1, d2, m1)); + UNIT_TEST_CHECK(merge3(anc, d1, d2, m1)); if (gm != m1) dump_incorrect_merge (gm, m1, "merge_addition 1"); - BOOST_CHECK(gm == m1); + UNIT_TEST_CHECK(gm == m1); - BOOST_CHECK(merge3(anc, d2, d1, m2)); + UNIT_TEST_CHECK(merge3(anc, d2, d1, m2)); if (gm != m2) dump_incorrect_merge (gm, m2, "merge_addition 2"); - BOOST_CHECK(gm == m2); + UNIT_TEST_CHECK(gm == m2); - BOOST_CHECK(!merge3(anc, d1, cf, m1)); + UNIT_TEST_CHECK(!merge3(anc, d1, cf, m1)); } UNIT_TEST(diff_patch, merge_deletions) @@ -1511,15 +1511,15 @@ UNIT_TEST(diff_patch, merge_deletions) d1 = anc; gm = d2; - BOOST_CHECK(merge3(anc, d1, d2, m1)); + UNIT_TEST_CHECK(merge3(anc, d1, d2, m1)); if (gm != m1) dump_incorrect_merge (gm, m1, "merge_deletion 1"); - BOOST_CHECK(gm == m1); + UNIT_TEST_CHECK(gm == m1); - BOOST_CHECK(merge3(anc, d2, d1, m2)); + UNIT_TEST_CHECK(merge3(anc, d2, d1, m2)); if (gm != m2) dump_incorrect_merge (gm, m2, "merge_deletion 2"); - BOOST_CHECK(gm == m2); + UNIT_TEST_CHECK(gm == m2); } #endif // BUILD_UNIT_TESTS ============================================================ --- globish.cc 316d1da34877cb89cb11ea55741be9343c476ff6 +++ globish.cc 9d9680696d2be391787e6697214a544fe955c016 @@ -164,30 +164,30 @@ UNIT_TEST(globish, checked_globish_to_re string pat; checked_globish_to_regex("*", pat); - BOOST_CHECK(pat == ".*"); + UNIT_TEST_CHECK(pat == ".*"); checked_globish_to_regex("?", pat); - BOOST_CHECK(pat == "."); + UNIT_TEST_CHECK(pat == "."); checked_globish_to_regex("{a,b,c}d", pat); - BOOST_CHECK(pat == "(a|b|c)d"); + UNIT_TEST_CHECK(pat == "(a|b|c)d"); checked_globish_to_regex("foo{a,{b,c},?*}d", pat); - BOOST_CHECK(pat == "foo(a|(b|c)|..*)d"); + UNIT_TEST_CHECK(pat == "foo(a|(b|c)|..*)d"); checked_globish_to_regex("\\a\\b\\|\\{\\*", pat); - BOOST_CHECK(pat == "ab\\|\\{\\*"); + UNIT_TEST_CHECK(pat == "ab\\|\\{\\*"); checked_globish_to_regex(".+$^{}", pat); - BOOST_CHECK(pat == "\\.\\+\\$\\^()"); + UNIT_TEST_CHECK(pat == "\\.\\+\\$\\^()"); checked_globish_to_regex(",", pat); // we're very conservative about metacharacters, and quote all // non-alphanumerics, hence the backslash - BOOST_CHECK(pat == "\\,"); + UNIT_TEST_CHECK(pat == "\\,"); checked_globish_to_regex("\\.\\+\\$\\^\\(\\)", pat); - BOOST_CHECK(pat == "\\.\\+\\$\\^\\(\\)"); + UNIT_TEST_CHECK(pat == "\\.\\+\\$\\^\\(\\)"); - BOOST_CHECK_THROW(checked_globish_to_regex("foo\\", pat), informative_failure); - BOOST_CHECK_THROW(checked_globish_to_regex("{foo", pat), informative_failure); - BOOST_CHECK_THROW(checked_globish_to_regex("{foo,bar{baz,quux}", pat), informative_failure); - BOOST_CHECK_THROW(checked_globish_to_regex("foo}", pat), informative_failure); - BOOST_CHECK_THROW(checked_globish_to_regex("foo,bar{baz,quux}}", pat), informative_failure); - BOOST_CHECK_THROW(checked_globish_to_regex("{{{{{{{{{{a,b},c},d},e},f},g},h},i},j},k}", pat), informative_failure); + UNIT_TEST_CHECK_THROW(checked_globish_to_regex("foo\\", pat), informative_failure); + UNIT_TEST_CHECK_THROW(checked_globish_to_regex("{foo", pat), informative_failure); + UNIT_TEST_CHECK_THROW(checked_globish_to_regex("{foo,bar{baz,quux}", pat), informative_failure); + UNIT_TEST_CHECK_THROW(checked_globish_to_regex("foo}", pat), informative_failure); + UNIT_TEST_CHECK_THROW(checked_globish_to_regex("foo,bar{baz,quux}}", pat), informative_failure); + UNIT_TEST_CHECK_THROW(checked_globish_to_regex("{{{{{{{{{{a,b},c},d},e},f},g},h},i},j},k}", pat), informative_failure); } UNIT_TEST(globish, combine_and_check_globish) @@ -198,39 +198,39 @@ UNIT_TEST(globish, combine_and_check_glo s.push_back(globish("c")); globish combined; combine_and_check_globish(s, combined); - BOOST_CHECK(combined() == "{a,b,c}"); + UNIT_TEST_CHECK(combined() == "{a,b,c}"); } UNIT_TEST(globish, globish_matcher) { { globish_matcher m(globish("{a,b}?*\\*|"), globish("*c*")); - BOOST_CHECK(m("aq*|")); - BOOST_CHECK(m("bq*|")); - BOOST_CHECK(!m("bc*|")); - BOOST_CHECK(!m("bq|")); - BOOST_CHECK(!m("b*|")); - BOOST_CHECK(!m("")); + UNIT_TEST_CHECK(m("aq*|")); + UNIT_TEST_CHECK(m("bq*|")); + UNIT_TEST_CHECK(!m("bc*|")); + UNIT_TEST_CHECK(!m("bq|")); + UNIT_TEST_CHECK(!m("b*|")); + UNIT_TEST_CHECK(!m("")); } { globish_matcher m(globish("{a,\\\\,b*}"), globish("*c*")); - BOOST_CHECK(m("a")); - BOOST_CHECK(!m("ab")); - BOOST_CHECK(m("\\")); - BOOST_CHECK(!m("\\\\")); - BOOST_CHECK(m("b")); - BOOST_CHECK(m("bfoobar")); - BOOST_CHECK(!m("bfoobarcfoobar")); + UNIT_TEST_CHECK(m("a")); + UNIT_TEST_CHECK(!m("ab")); + UNIT_TEST_CHECK(m("\\")); + UNIT_TEST_CHECK(!m("\\\\")); + UNIT_TEST_CHECK(m("b")); + UNIT_TEST_CHECK(m("bfoobar")); + UNIT_TEST_CHECK(!m("bfoobarcfoobar")); } { globish_matcher m(globish("*"), globish("")); - BOOST_CHECK(m("foo")); - BOOST_CHECK(m("")); + UNIT_TEST_CHECK(m("foo")); + UNIT_TEST_CHECK(m("")); } { globish_matcher m(globish("{foo}"), globish("")); - BOOST_CHECK(m("foo")); - BOOST_CHECK(!m("bar")); + UNIT_TEST_CHECK(m("foo")); + UNIT_TEST_CHECK(!m("bar")); } } ============================================================ --- keys.cc c57e3f6a336fcfcd4aec579147269a9ec1a0f279 +++ keys.cc aec2f1b3cab5149ce6be1db4e771f5d6708b8316 @@ -700,15 +700,15 @@ UNIT_TEST(key, arc4) SecureVector data(orig); - BOOST_CHECKPOINT("encrypting data"); + UNIT_TEST_CHECKPOINT("encrypting data"); do_arc4(phrase, data); - BOOST_CHECK(data != orig); + UNIT_TEST_CHECK(data != orig); - BOOST_CHECKPOINT("decrypting data"); + UNIT_TEST_CHECKPOINT("decrypting data"); do_arc4(phrase, data); - BOOST_CHECK(data == orig); + UNIT_TEST_CHECK(data == orig); } @@ -718,24 +718,24 @@ UNIT_TEST(key, signature_round_trip) app.lua.add_std_hooks(); app.lua.add_test_hooks(); - BOOST_CHECKPOINT("generating key pairs"); + UNIT_TEST_CHECKPOINT("generating key pairs"); keypair kp; utf8 passphrase("address@hidden"); rsa_keypair_id key("address@hidden"); generate_key_pair(kp, passphrase); app.keys.put_key_pair(key, kp); - BOOST_CHECKPOINT("signing plaintext"); + UNIT_TEST_CHECKPOINT("signing plaintext"); string plaintext("test string to sign"); base64 sig; make_signature(app, key, kp.priv, plaintext, sig); - BOOST_CHECKPOINT("checking signature"); - BOOST_CHECK(check_signature(app, key, kp.pub, plaintext, sig)); + UNIT_TEST_CHECKPOINT("checking signature"); + UNIT_TEST_CHECK(check_signature(app, key, kp.pub, plaintext, sig)); string broken_plaintext = plaintext + " ...with a lie"; - BOOST_CHECKPOINT("checking non-signature"); - BOOST_CHECK(!check_signature(app, key, kp.pub, broken_plaintext, sig)); + UNIT_TEST_CHECKPOINT("checking non-signature"); + UNIT_TEST_CHECK(!check_signature(app, key, kp.pub, broken_plaintext, sig)); app.keys.delete_key(key); } ============================================================ --- m4/boost.m4 38f52769f29b3e6b8b0581df762f4de7cc42c907 +++ m4/boost.m4 e5f267509cb19516efa4424ccbfdee12e47f1911 @@ -181,20 +181,3 @@ AC_DEFUN([MTN_BOOST_LIB_REGEX], ]],[[ regex expr("foo"); ]])])]) - -dnl Unlike all the others, if we don't have this library we can still -dnl build monotone; we just can't do all the tests. -AC_DEFUN([MTN_BOOST_LIB_UNIT_TEST_FRAMEWORK], -[BOOST_LIB_IFELSE([unit_test_framework], - [AC_LANG_SOURCE([[ - #include - #include - using boost::unit_test_framework::test_suite; - test_suite * init_unit_test_suite(int argc, char * argv[]) - { return NULL; } - ]])], - [AM_CONDITIONAL(BUILD_UNIT_TESTS, true) - BOOST_UNITTEST="$lib"], - [AM_CONDITIONAL(BUILD_UNIT_TESTS, false)]) - AC_SUBST(BOOST_UNITTEST) -]) ============================================================ --- netcmd.cc f5c66fabed53103434a5e728525b7c8414f6736d +++ netcmd.cc d397060be17a91e9232b83454d59ae0e0ae76146 @@ -565,7 +565,7 @@ UNIT_TEST(netcmd, mac) chained_hmac mac(key, true); // mutates mac out_cmd.write(buf, mac); - BOOST_CHECK_THROW(in_cmd.read_string(buf, mac), bad_decode); + UNIT_TEST_CHECK_THROW(in_cmd.read_string(buf, mac), bad_decode); } { @@ -575,7 +575,7 @@ UNIT_TEST(netcmd, mac) buf[0] ^= 0xff; { chained_hmac mac(key, true); - BOOST_CHECK_THROW(in_cmd.read_string(buf, mac), bad_decode); + UNIT_TEST_CHECK_THROW(in_cmd.read_string(buf, mac), bad_decode); } { @@ -585,7 +585,7 @@ UNIT_TEST(netcmd, mac) buf[buf.size() - 1] ^= 0xff; { chained_hmac mac(key, true); - BOOST_CHECK_THROW(in_cmd.read_string(buf, mac), bad_decode); + UNIT_TEST_CHECK_THROW(in_cmd.read_string(buf, mac), bad_decode); } { @@ -595,7 +595,7 @@ UNIT_TEST(netcmd, mac) buf += '\0'; { chained_hmac mac(key, true); - BOOST_CHECK_THROW(in_cmd.read_string(buf, mac), bad_decode); + UNIT_TEST_CHECK_THROW(in_cmd.read_string(buf, mac), bad_decode); } } @@ -609,9 +609,9 @@ do_netcmd_roundtrip(netcmd const & out_c } { chained_hmac mac(key, true); - BOOST_CHECK(in_cmd.read_string(buf, mac)); + UNIT_TEST_CHECK(in_cmd.read_string(buf, mac)); } - BOOST_CHECK(in_cmd == out_cmd); + UNIT_TEST_CHECK(in_cmd == out_cmd); } UNIT_TEST(netcmd, functions) @@ -629,7 +629,7 @@ UNIT_TEST(netcmd, functions) out_cmd.write_error_cmd(out_errmsg); do_netcmd_roundtrip(out_cmd, in_cmd, buf); in_cmd.read_error_cmd(in_errmsg); - BOOST_CHECK(in_errmsg == out_errmsg); + UNIT_TEST_CHECK(in_errmsg == out_errmsg); L(FL("errmsg_cmd test done, buffer was %d bytes") % buf.size()); } @@ -644,9 +644,9 @@ UNIT_TEST(netcmd, functions) out_cmd.write_hello_cmd(out_server_keyname, out_server_key, out_nonce); do_netcmd_roundtrip(out_cmd, in_cmd, buf); in_cmd.read_hello_cmd(in_server_keyname, in_server_key, in_nonce); - BOOST_CHECK(in_server_keyname == out_server_keyname); - BOOST_CHECK(in_server_key == out_server_key); - BOOST_CHECK(in_nonce == out_nonce); + UNIT_TEST_CHECK(in_server_keyname == out_server_keyname); + UNIT_TEST_CHECK(in_server_key == out_server_key); + UNIT_TEST_CHECK(in_nonce == out_nonce); L(FL("hello_cmd test done, buffer was %d bytes") % buf.size()); } @@ -660,7 +660,7 @@ UNIT_TEST(netcmd, functions) out_cmd.write_bye_cmd(out_phase); do_netcmd_roundtrip(out_cmd, in_cmd, buf); in_cmd.read_bye_cmd(in_phase); - BOOST_CHECK(in_phase == out_phase); + UNIT_TEST_CHECK(in_phase == out_phase); L(FL("bye_cmd test done, buffer was %d bytes") % buf.size()); } @@ -679,10 +679,10 @@ UNIT_TEST(netcmd, functions) out_cmd.write_anonymous_cmd(out_role, out_include_pattern, out_exclude_pattern, out_key); do_netcmd_roundtrip(out_cmd, in_cmd, buf); in_cmd.read_anonymous_cmd(in_role, in_include_pattern, in_exclude_pattern, in_key); - BOOST_CHECK(in_key == out_key); - BOOST_CHECK(in_include_pattern == out_include_pattern); - BOOST_CHECK(in_exclude_pattern == out_exclude_pattern); - BOOST_CHECK(in_role == out_role); + UNIT_TEST_CHECK(in_key == out_key); + UNIT_TEST_CHECK(in_include_pattern == out_include_pattern); + UNIT_TEST_CHECK(in_exclude_pattern == out_exclude_pattern); + UNIT_TEST_CHECK(in_role == out_role); L(FL("anonymous_cmd test done, buffer was %d bytes") % buf.size()); } @@ -706,13 +706,13 @@ UNIT_TEST(netcmd, functions) do_netcmd_roundtrip(out_cmd, in_cmd, buf); in_cmd.read_auth_cmd(in_role, in_include_pattern, in_exclude_pattern, in_client, in_nonce1, in_key, in_signature); - BOOST_CHECK(in_client == out_client); - BOOST_CHECK(in_nonce1 == out_nonce1); - BOOST_CHECK(in_key == out_key); - BOOST_CHECK(in_signature == out_signature); - BOOST_CHECK(in_role == out_role); - BOOST_CHECK(in_include_pattern == out_include_pattern); - BOOST_CHECK(in_exclude_pattern == out_exclude_pattern); + UNIT_TEST_CHECK(in_client == out_client); + UNIT_TEST_CHECK(in_nonce1 == out_nonce1); + UNIT_TEST_CHECK(in_key == out_key); + UNIT_TEST_CHECK(in_signature == out_signature); + UNIT_TEST_CHECK(in_role == out_role); + UNIT_TEST_CHECK(in_include_pattern == out_include_pattern); + UNIT_TEST_CHECK(in_exclude_pattern == out_exclude_pattern); L(FL("auth_cmd test done, buffer was %d bytes") % buf.size()); } @@ -747,8 +747,8 @@ UNIT_TEST(netcmd, functions) out_cmd.write_refine_cmd(out_ty, out_node); do_netcmd_roundtrip(out_cmd, in_cmd, buf); in_cmd.read_refine_cmd(in_ty, in_node); - BOOST_CHECK(in_ty == out_ty); - BOOST_CHECK(in_node == out_node); + UNIT_TEST_CHECK(in_ty == out_ty); + UNIT_TEST_CHECK(in_node == out_node); L(FL("refine_cmd test done, buffer was %d bytes") % buf.size()); } @@ -763,8 +763,8 @@ UNIT_TEST(netcmd, functions) out_cmd.write_done_cmd(out_type, out_n_items); do_netcmd_roundtrip(out_cmd, in_cmd, buf); in_cmd.read_done_cmd(in_type, in_n_items); - BOOST_CHECK(in_n_items == out_n_items); - BOOST_CHECK(in_type == out_type); + UNIT_TEST_CHECK(in_n_items == out_n_items); + UNIT_TEST_CHECK(in_type == out_type); L(FL("done_cmd test done, buffer was %d bytes") % buf.size()); } @@ -779,8 +779,8 @@ UNIT_TEST(netcmd, functions) out_cmd.write_data_cmd(out_type, out_id, out_dat); do_netcmd_roundtrip(out_cmd, in_cmd, buf); in_cmd.read_data_cmd(in_type, in_id, in_dat); - BOOST_CHECK(in_id == out_id); - BOOST_CHECK(in_dat == out_dat); + UNIT_TEST_CHECK(in_id == out_id); + UNIT_TEST_CHECK(in_dat == out_dat); L(FL("data_cmd test done, buffer was %d bytes") % buf.size()); } @@ -797,10 +797,10 @@ UNIT_TEST(netcmd, functions) out_cmd.write_delta_cmd(out_type, out_head, out_base, out_delta); do_netcmd_roundtrip(out_cmd, in_cmd, buf); in_cmd.read_delta_cmd(in_type, in_head, in_base, in_delta); - BOOST_CHECK(in_type == out_type); - BOOST_CHECK(in_head == out_head); - BOOST_CHECK(in_base == out_base); - BOOST_CHECK(in_delta == out_delta); + UNIT_TEST_CHECK(in_type == out_type); + UNIT_TEST_CHECK(in_head == out_head); + UNIT_TEST_CHECK(in_base == out_base); + UNIT_TEST_CHECK(in_delta == out_delta); L(FL("delta_cmd test done, buffer was %d bytes") % buf.size()); } ============================================================ --- option.cc 9809180c2ab1a052157c0d246bea91b8594c1aae +++ option.cc 75b60fa96a8aefab50c6b0a1a16b255bf40b9933 @@ -501,12 +501,12 @@ UNIT_TEST(option, concrete_options) "--int", "45", "--", "--bad", "foo", "-b"}; os.from_command_line(12, cmdline); } - BOOST_CHECK(!b); - BOOST_CHECK(i == 45); - BOOST_CHECK(s == "str ing"); - BOOST_CHECK(v.size() == 4);// pos --bad foo -b + UNIT_TEST_CHECK(!b); + UNIT_TEST_CHECK(i == 45); + UNIT_TEST_CHECK(s == "str ing"); + UNIT_TEST_CHECK(v.size() == 4);// pos --bad foo -b os.reset(); - BOOST_CHECK(v.empty()); + UNIT_TEST_CHECK(v.empty()); { args_vector cmdline; @@ -516,36 +516,36 @@ UNIT_TEST(option, concrete_options) cmdline.push_back(arg_type("foo")); os.from_command_line(cmdline); } - BOOST_CHECK(b); - BOOST_CHECK(s == "-s"); - BOOST_CHECK(v.size() == 1); - BOOST_CHECK(v[0] == "foo"); + UNIT_TEST_CHECK(b); + UNIT_TEST_CHECK(s == "-s"); + UNIT_TEST_CHECK(v.size() == 1); + UNIT_TEST_CHECK(v[0] == "foo"); os.reset(); - BOOST_CHECK(!b); + UNIT_TEST_CHECK(!b); { char const * cmdline[] = {"progname", "--bad_arg", "x"}; - BOOST_CHECK_THROW(os.from_command_line(3, cmdline), option::unknown_option); + UNIT_TEST_CHECK_THROW(os.from_command_line(3, cmdline), option::unknown_option); } { char const * cmdline[] = {"progname", "--bool=x"}; - BOOST_CHECK_THROW(os.from_command_line(2, cmdline), option::extra_arg); + UNIT_TEST_CHECK_THROW(os.from_command_line(2, cmdline), option::extra_arg); } { char const * cmdline[] = {"progname", "-bx"}; - BOOST_CHECK_THROW(os.from_command_line(2, cmdline), option::extra_arg); + UNIT_TEST_CHECK_THROW(os.from_command_line(2, cmdline), option::extra_arg); } { char const * cmdline[] = {"progname", "-s"}; - BOOST_CHECK_THROW(os.from_command_line(2, cmdline), option::missing_arg); + UNIT_TEST_CHECK_THROW(os.from_command_line(2, cmdline), option::missing_arg); } { char const * cmdline[] = {"progname", "--int=x"}; - BOOST_CHECK_THROW(os.from_command_line(2, cmdline), option::bad_arg); + UNIT_TEST_CHECK_THROW(os.from_command_line(2, cmdline), option::bad_arg); } } ============================================================ --- outdated_indicator.cc 317f240d2e417e8465461d5ac9afe4cdb889d05f +++ outdated_indicator.cc f1b81dda2764ff8a6bae829ec88e68cde1f8b580 @@ -92,17 +92,17 @@ UNIT_TEST(outdated_indicator, ) outdated_indicator indicator; { outdated_indicator_factory factory; - BOOST_CHECK(indicator.outdated()); + UNIT_TEST_CHECK(indicator.outdated()); indicator = factory.get_indicator(); - BOOST_CHECK(!indicator.outdated()); + UNIT_TEST_CHECK(!indicator.outdated()); factory.note_change(); - BOOST_CHECK(indicator.outdated()); + UNIT_TEST_CHECK(indicator.outdated()); factory.note_change(); factory.note_change(); indicator = factory.get_indicator(); - BOOST_CHECK(!indicator.outdated()); + UNIT_TEST_CHECK(!indicator.outdated()); } - BOOST_CHECK(indicator.outdated()); + UNIT_TEST_CHECK(indicator.outdated()); } #endif ============================================================ --- packet.cc 991e6a99aeb8e43d48d09d64b22e080bb617f08f +++ packet.cc 98bc3698868eba6ee9e1a5fbe65b56f38cf4e6cd @@ -359,7 +359,7 @@ UNIT_TEST(packet, roundabout) packet_writer pw(oss); istringstream iss(tmp); read_packets(iss, pw, aaa); - BOOST_CHECK(oss.str() == tmp); + UNIT_TEST_CHECK(oss.str() == tmp); tmp = oss.str(); } } ============================================================ --- paths.cc 0b81dfd4a65442de417c635cd8f003994af44ee1 +++ paths.cc 1bf8148ef65b40754d726c9d047093e83a8c042b @@ -740,7 +740,7 @@ UNIT_TEST(paths, null_name) UNIT_TEST(paths, null_name) { - BOOST_CHECK(null_name(the_null_component)); + UNIT_TEST_CHECK(null_name(the_null_component)); } UNIT_TEST(paths, file_path_internal) @@ -782,17 +782,17 @@ UNIT_TEST(paths, file_path_internal) initial_rel_path.set(fs::path(), true); for (char const ** c = baddies; *c; ++c) { - BOOST_CHECK_THROW(file_path_internal(*c), logic_error); + UNIT_TEST_CHECK_THROW(file_path_internal(*c), logic_error); } initial_rel_path.unset(); initial_rel_path.set(fs::path("blah/blah/blah", fs::native), true); for (char const ** c = baddies; *c; ++c) { - BOOST_CHECK_THROW(file_path_internal(*c), logic_error); + UNIT_TEST_CHECK_THROW(file_path_internal(*c), logic_error); } - BOOST_CHECK(file_path().empty()); - BOOST_CHECK(file_path_internal("").empty()); + UNIT_TEST_CHECK(file_path().empty()); + UNIT_TEST_CHECK(file_path_internal("").empty()); char const * goodies[] = {"", "a", @@ -817,17 +817,17 @@ UNIT_TEST(paths, file_path_internal) for (char const ** c = goodies; *c; ++c) { file_path fp = file_path_internal(*c); - BOOST_CHECK(fp.as_internal() == *c); - BOOST_CHECK(file_path_internal(fp.as_internal()) == fp); + UNIT_TEST_CHECK(fp.as_internal() == *c); + UNIT_TEST_CHECK(file_path_internal(fp.as_internal()) == fp); split_path split_test; fp.split(split_test); - BOOST_CHECK(!split_test.empty()); + UNIT_TEST_CHECK(!split_test.empty()); file_path fp2(split_test); - BOOST_CHECK(fp == fp2); - BOOST_CHECK(null_name(split_test[0])); + UNIT_TEST_CHECK(fp == fp2); + UNIT_TEST_CHECK(null_name(split_test[0])); for (split_path::const_iterator i = split_test.begin() + 1; i != split_test.end(); ++i) - BOOST_CHECK(!null_name(*i)); + UNIT_TEST_CHECK(!null_name(*i)); } } @@ -839,20 +839,20 @@ static void check_fp_normalizes_to(char L(FL("check_fp_normalizes_to: '%s' -> '%s'") % before % after); file_path fp = file_path_external(utf8(before)); L(FL(" (got: %s)") % fp); - BOOST_CHECK(fp.as_internal() == after); - BOOST_CHECK(file_path_internal(fp.as_internal()) == fp); + UNIT_TEST_CHECK(fp.as_internal() == after); + UNIT_TEST_CHECK(file_path_internal(fp.as_internal()) == fp); // we compare after to the external form too, since as far as we know // relative normalized posix paths are always good win32 paths too - BOOST_CHECK(fp.as_external() == after); + UNIT_TEST_CHECK(fp.as_external() == after); split_path split_test; fp.split(split_test); - BOOST_CHECK(!split_test.empty()); + UNIT_TEST_CHECK(!split_test.empty()); file_path fp2(split_test); - BOOST_CHECK(fp == fp2); - BOOST_CHECK(null_name(split_test[0])); + UNIT_TEST_CHECK(fp == fp2); + UNIT_TEST_CHECK(null_name(split_test[0])); for (split_path::const_iterator i = split_test.begin() + 1; i != split_test.end(); ++i) - BOOST_CHECK(!null_name(*i)); + UNIT_TEST_CHECK(!null_name(*i)); } UNIT_TEST(paths, file_path_external_null_prefix) @@ -891,7 +891,7 @@ UNIT_TEST(paths, file_path_external_null for (char const ** c = baddies; *c; ++c) { L(FL("test_file_path_external_null_prefix: trying baddie: %s") % *c); - BOOST_CHECK_THROW(file_path_external(utf8(*c)), informative_failure); + UNIT_TEST_CHECK_THROW(file_path_external(utf8(*c)), informative_failure); } check_fp_normalizes_to("a", "a"); @@ -929,9 +929,9 @@ UNIT_TEST(paths, file_path_external_pref initial_rel_path.unset(); initial_rel_path.set(fs::path("_MTN"), true); - BOOST_CHECK_THROW(file_path_external(utf8("foo")), informative_failure); - BOOST_CHECK_THROW(file_path_external(utf8(".")), informative_failure); - BOOST_CHECK_THROW(file_path_external(utf8("./blah")), informative_failure); + UNIT_TEST_CHECK_THROW(file_path_external(utf8("foo")), informative_failure); + UNIT_TEST_CHECK_THROW(file_path_external(utf8(".")), informative_failure); + UNIT_TEST_CHECK_THROW(file_path_external(utf8("./blah")), informative_failure); check_fp_normalizes_to("..", ""); check_fp_normalizes_to("../foo", "foo"); } @@ -974,7 +974,7 @@ UNIT_TEST(paths, file_path_external_pref for (char const ** c = baddies; *c; ++c) { L(FL("test_file_path_external_prefix_a_b: trying baddie: %s") % *c); - BOOST_CHECK_THROW(file_path_external(utf8(*c)), informative_failure); + UNIT_TEST_CHECK_THROW(file_path_external(utf8(*c)), informative_failure); } check_fp_normalizes_to("foo", "a/b/foo"); @@ -1023,42 +1023,42 @@ UNIT_TEST(paths, split_join) split_path split1, split2; fp1.split(split1); fp2.split(split2); - BOOST_CHECK(fp1 == file_path(split1)); - BOOST_CHECK(fp2 == file_path(split2)); - BOOST_CHECK(!(fp1 == file_path(split2))); - BOOST_CHECK(!(fp2 == file_path(split1))); - BOOST_CHECK(split1.size() == 4); - BOOST_CHECK(split2.size() == 4); - BOOST_CHECK(split1[1] != split1[2]); - BOOST_CHECK(split1[1] != split1[3]); - BOOST_CHECK(split1[2] != split1[3]); - BOOST_CHECK(null_name(split1[0]) + UNIT_TEST_CHECK(fp1 == file_path(split1)); + UNIT_TEST_CHECK(fp2 == file_path(split2)); + UNIT_TEST_CHECK(!(fp1 == file_path(split2))); + UNIT_TEST_CHECK(!(fp2 == file_path(split1))); + UNIT_TEST_CHECK(split1.size() == 4); + UNIT_TEST_CHECK(split2.size() == 4); + UNIT_TEST_CHECK(split1[1] != split1[2]); + UNIT_TEST_CHECK(split1[1] != split1[3]); + UNIT_TEST_CHECK(split1[2] != split1[3]); + UNIT_TEST_CHECK(null_name(split1[0]) && !null_name(split1[1]) && !null_name(split1[2]) && !null_name(split1[3])); - BOOST_CHECK(split1[1] == split2[3]); - BOOST_CHECK(split1[2] == split2[1]); - BOOST_CHECK(split1[3] == split2[2]); + UNIT_TEST_CHECK(split1[1] == split2[3]); + UNIT_TEST_CHECK(split1[2] == split2[1]); + UNIT_TEST_CHECK(split1[3] == split2[2]); file_path fp3 = file_path_internal(""); split_path split3; fp3.split(split3); - BOOST_CHECK(split3.size() == 1 && null_name(split3[0])); + UNIT_TEST_CHECK(split3.size() == 1 && null_name(split3[0])); // empty split_path is invalid split_path split4; // this comparison tricks the compiler into not completely eliminating this // code as dead... - BOOST_CHECK_THROW(file_path(split4) == file_path(), logic_error); + UNIT_TEST_CHECK_THROW(file_path(split4) == file_path(), logic_error); split4.push_back(the_null_component); - BOOST_CHECK(file_path(split4) == file_path()); + UNIT_TEST_CHECK(file_path(split4) == file_path()); // split_path without null first item is invalid split4.clear(); split4.push_back(split1[1]); // this comparison tricks the compiler into not completely eliminating this // code as dead... - BOOST_CHECK_THROW(file_path(split4) == file_path(), logic_error); + UNIT_TEST_CHECK_THROW(file_path(split4) == file_path(), logic_error); // split_path with non-first item item null is invalid split4.clear(); @@ -1067,40 +1067,40 @@ UNIT_TEST(paths, split_join) split4.push_back(the_null_component); // this comparison tricks the compiler into not completely eliminating this // code as dead... - BOOST_CHECK_THROW(file_path(split4) == file_path(), logic_error); + UNIT_TEST_CHECK_THROW(file_path(split4) == file_path(), logic_error); // Make sure that we can't use joining to create a path into the bookkeeping // dir { split_path split_mt1, split_mt2; file_path_internal("foo/_MTN").split(split_mt1); - BOOST_CHECK(split_mt1.size() == 3); + UNIT_TEST_CHECK(split_mt1.size() == 3); I(split_mt1[2] == bookkeeping_root_component); split_mt2.push_back(the_null_component); split_mt2.push_back(split_mt1[2]); // split_mt2 now contains the component "_MTN" - BOOST_CHECK_THROW(file_path(split_mt2) == file_path(), logic_error); + UNIT_TEST_CHECK_THROW(file_path(split_mt2) == file_path(), logic_error); split_mt2.push_back(split_mt1[1]); // split_mt2 now contains the components "_MTN", "foo" in that order // this comparison tricks the compiler into not completely eliminating this // code as dead... - BOOST_CHECK_THROW(file_path(split_mt2) == file_path(), logic_error); + UNIT_TEST_CHECK_THROW(file_path(split_mt2) == file_path(), logic_error); } // and make sure it fails for the klugy security cases -- see comments on // in_bookkeeping_dir { split_path split_mt1, split_mt2; file_path_internal("foo/_mTn").split(split_mt1); - BOOST_CHECK(split_mt1.size() == 3); + UNIT_TEST_CHECK(split_mt1.size() == 3); split_mt2.push_back(the_null_component); split_mt2.push_back(split_mt1[2]); // split_mt2 now contains the component "_mTn" - BOOST_CHECK_THROW(file_path(split_mt2) == file_path(), logic_error); + UNIT_TEST_CHECK_THROW(file_path(split_mt2) == file_path(), logic_error); split_mt2.push_back(split_mt1[1]); // split_mt2 now contains the components "_mTn", "foo" in that order // this comparison tricks the compiler into not completely eliminating this // code as dead... - BOOST_CHECK_THROW(file_path(split_mt2) == file_path(), logic_error); + UNIT_TEST_CHECK_THROW(file_path(split_mt2) == file_path(), logic_error); } } @@ -1108,8 +1108,8 @@ static void check_bk_normalizes_to(char { bookkeeping_path bp(bookkeeping_root / before); L(FL("normalizing %s to %s (got %s)") % before % after % bp); - BOOST_CHECK(bp.as_external() == after); - BOOST_CHECK(bookkeeping_path(bp.as_internal()).as_internal() == bp.as_internal()); + UNIT_TEST_CHECK(bp.as_external() == after); + UNIT_TEST_CHECK(bookkeeping_path(bp.as_internal()).as_internal() == bp.as_internal()); } UNIT_TEST(paths, bookkeeping) @@ -1136,11 +1136,11 @@ UNIT_TEST(paths, bookkeeping) for (char const ** c = baddies; *c; ++c) { L(FL("test_bookkeeping_path baddie: trying '%s'") % *c); - BOOST_CHECK_THROW(bookkeeping_path(tmp_path_string.assign(*c)), logic_error); - BOOST_CHECK_THROW(bookkeeping_root / tmp_path_string.assign(*c), logic_error); + UNIT_TEST_CHECK_THROW(bookkeeping_path(tmp_path_string.assign(*c)), logic_error); + UNIT_TEST_CHECK_THROW(bookkeeping_root / tmp_path_string.assign(*c), logic_error); } - BOOST_CHECK_THROW(bookkeeping_path(tmp_path_string.assign("foo/bar")), logic_error); - BOOST_CHECK_THROW(bookkeeping_path(tmp_path_string.assign("a")), logic_error); + UNIT_TEST_CHECK_THROW(bookkeeping_path(tmp_path_string.assign("foo/bar")), logic_error); + UNIT_TEST_CHECK_THROW(bookkeeping_path(tmp_path_string.assign("a")), logic_error); check_bk_normalizes_to("a", "_MTN/a"); check_bk_normalizes_to("foo", "_MTN/foo"); @@ -1152,8 +1152,8 @@ static void check_system_normalizes_to(c { system_path sp(before); L(FL("normalizing '%s' to '%s' (got '%s')") % before % after % sp); - BOOST_CHECK(sp.as_external() == after); - BOOST_CHECK(system_path(sp.as_internal()).as_internal() == sp.as_internal()); + UNIT_TEST_CHECK(sp.as_external() == after); + UNIT_TEST_CHECK(system_path(sp.as_internal()).as_internal() == sp.as_internal()); } UNIT_TEST(paths, system) @@ -1161,7 +1161,7 @@ UNIT_TEST(paths, system) initial_abs_path.unset(); initial_abs_path.set(system_path("/a/b"), true); - BOOST_CHECK_THROW(system_path(""), informative_failure); + UNIT_TEST_CHECK_THROW(system_path(""), informative_failure); check_system_normalizes_to("foo", "/a/b/foo"); check_system_normalizes_to("foo/bar", "/a/b/foo/bar"); @@ -1196,18 +1196,18 @@ UNIT_TEST(paths, system) // least we can check that it's doing _something_... string tilde_expanded = system_path("~/foo").as_external(); #ifdef WIN32 - BOOST_CHECK(tilde_expanded[1] == ':'); + UNIT_TEST_CHECK(tilde_expanded[1] == ':'); #else - BOOST_CHECK(tilde_expanded[0] == '/'); + UNIT_TEST_CHECK(tilde_expanded[0] == '/'); #endif - BOOST_CHECK(tilde_expanded.find('~') == string::npos); + UNIT_TEST_CHECK(tilde_expanded.find('~') == string::npos); // and check for the weird WIN32 version #ifdef WIN32 string tilde_expanded2 = system_path("~this_user_does_not_exist_anywhere").as_external(); - BOOST_CHECK(tilde_expanded2[1] == ':'); - BOOST_CHECK(tilde_expanded2.find('~') == string::npos); + UNIT_TEST_CHECK(tilde_expanded2[1] == ':'); + UNIT_TEST_CHECK(tilde_expanded2.find('~') == string::npos); #else - BOOST_CHECK_THROW(system_path("~this_user_does_not_exist_anywhere"), informative_failure); + UNIT_TEST_CHECK_THROW(system_path("~this_user_does_not_exist_anywhere"), informative_failure); #endif // finally, make sure that the copy-from-any_path constructor works right @@ -1218,24 +1218,24 @@ UNIT_TEST(paths, system) initial_rel_path.unset(); initial_rel_path.set(fs::path("rel/initial"), true); - BOOST_CHECK(system_path(system_path("foo/bar")).as_internal() == "/a/b/foo/bar"); - BOOST_CHECK(!working_root.used); - BOOST_CHECK(system_path(system_path("/foo/bar")).as_internal() == "/foo/bar"); - BOOST_CHECK(!working_root.used); - BOOST_CHECK(system_path(file_path_internal("foo/bar"), false).as_internal() + UNIT_TEST_CHECK(system_path(system_path("foo/bar")).as_internal() == "/a/b/foo/bar"); + UNIT_TEST_CHECK(!working_root.used); + UNIT_TEST_CHECK(system_path(system_path("/foo/bar")).as_internal() == "/foo/bar"); + UNIT_TEST_CHECK(!working_root.used); + UNIT_TEST_CHECK(system_path(file_path_internal("foo/bar"), false).as_internal() == "/working/root/foo/bar"); - BOOST_CHECK(!working_root.used); - BOOST_CHECK(system_path(file_path_internal("foo/bar")).as_internal() + UNIT_TEST_CHECK(!working_root.used); + UNIT_TEST_CHECK(system_path(file_path_internal("foo/bar")).as_internal() == "/working/root/foo/bar"); - BOOST_CHECK(working_root.used); - BOOST_CHECK(system_path(file_path_external(utf8("foo/bar"))).as_external() + UNIT_TEST_CHECK(working_root.used); + UNIT_TEST_CHECK(system_path(file_path_external(utf8("foo/bar"))).as_external() == "/working/root/rel/initial/foo/bar"); file_path a_file_path; - BOOST_CHECK(system_path(a_file_path).as_external() + UNIT_TEST_CHECK(system_path(a_file_path).as_external() == "/working/root"); - BOOST_CHECK(system_path(bookkeeping_path("_MTN/foo/bar")).as_internal() + UNIT_TEST_CHECK(system_path(bookkeeping_path("_MTN/foo/bar")).as_internal() == "/working/root/_MTN/foo/bar"); - BOOST_CHECK(system_path(bookkeeping_root).as_internal() + UNIT_TEST_CHECK(system_path(bookkeeping_root).as_internal() == "/working/root/_MTN"); initial_abs_path.unset(); working_root.unset(); @@ -1245,20 +1245,20 @@ UNIT_TEST(paths, access_tracker) UNIT_TEST(paths, access_tracker) { access_tracker a; - BOOST_CHECK_THROW(a.get(), logic_error); + UNIT_TEST_CHECK_THROW(a.get(), logic_error); a.set(1, false); - BOOST_CHECK_THROW(a.set(2, false), logic_error); + UNIT_TEST_CHECK_THROW(a.set(2, false), logic_error); a.set(2, true); - BOOST_CHECK_THROW(a.set(3, false), logic_error); - BOOST_CHECK(a.get() == 2); - BOOST_CHECK_THROW(a.set(3, true), logic_error); + UNIT_TEST_CHECK_THROW(a.set(3, false), logic_error); + UNIT_TEST_CHECK(a.get() == 2); + UNIT_TEST_CHECK_THROW(a.set(3, true), logic_error); a.unset(); a.may_not_initialize(); - BOOST_CHECK_THROW(a.set(1, false), logic_error); - BOOST_CHECK_THROW(a.set(2, true), logic_error); + UNIT_TEST_CHECK_THROW(a.set(1, false), logic_error); + UNIT_TEST_CHECK_THROW(a.set(2, true), logic_error); a.unset(); a.set(1, false); - BOOST_CHECK_THROW(a.may_not_initialize(), logic_error); + UNIT_TEST_CHECK_THROW(a.may_not_initialize(), logic_error); } static void test_a_path_ordering(string const & left, string const & right) @@ -1308,10 +1308,10 @@ UNIT_TEST(paths, test_internal_string_is "foo/bar", 0 }; for (char const ** c = yes; *c; ++c) - BOOST_CHECK(bookkeeping_path + UNIT_TEST_CHECK(bookkeeping_path ::internal_string_is_bookkeeping_path(utf8(std::string(*c)))); for (char const ** c = no; *c; ++c) - BOOST_CHECK(!bookkeeping_path + UNIT_TEST_CHECK(!bookkeeping_path ::internal_string_is_bookkeeping_path(utf8(std::string(*c)))); } @@ -1330,10 +1330,10 @@ UNIT_TEST(paths, test_external_string_is "_MTN/..", 0 }; for (char const ** c = yes; *c; ++c) - BOOST_CHECK(bookkeeping_path + UNIT_TEST_CHECK(bookkeeping_path ::external_string_is_bookkeeping_path(utf8(std::string(*c)))); for (char const ** c = no; *c; ++c) - BOOST_CHECK(!bookkeeping_path + UNIT_TEST_CHECK(!bookkeeping_path ::external_string_is_bookkeeping_path(utf8(std::string(*c)))); } @@ -1354,10 +1354,10 @@ UNIT_TEST(paths, test_external_string_is "../../foo/_MTN", 0 }; for (char const ** c = yes; *c; ++c) - BOOST_CHECK(bookkeeping_path + UNIT_TEST_CHECK(bookkeeping_path ::external_string_is_bookkeeping_path(utf8(std::string(*c)))); for (char const ** c = no; *c; ++c) - BOOST_CHECK(!bookkeeping_path + UNIT_TEST_CHECK(!bookkeeping_path ::external_string_is_bookkeeping_path(utf8(std::string(*c)))); } @@ -1377,10 +1377,10 @@ UNIT_TEST(paths, test_external_string_is "../foo/_MTN", 0 }; for (char const ** c = yes; *c; ++c) - BOOST_CHECK(bookkeeping_path + UNIT_TEST_CHECK(bookkeeping_path ::external_string_is_bookkeeping_path(utf8(std::string(*c)))); for (char const ** c = no; *c; ++c) - BOOST_CHECK(!bookkeeping_path + UNIT_TEST_CHECK(!bookkeeping_path ::external_string_is_bookkeeping_path(utf8(std::string(*c)))); } ============================================================ --- refiner.cc c4bacfb1eadaa252c39136468356585bdeebcc77 +++ refiner.cc c0ce0399c404b5463a7e9952fd063f0c55b89f21 @@ -509,8 +509,8 @@ refiner_pair crank(); // Refinement should have completed by here. - BOOST_CHECK(client.done); - BOOST_CHECK(server.done); + UNIT_TEST_CHECK(client.done); + UNIT_TEST_CHECK(server.done); check_set_differences("client", client); check_set_differences("server", server); @@ -520,8 +520,8 @@ refiner_pair check_no_redundant_sends("server->client", server.items_to_send, client.get_local_items()); - BOOST_CHECK(client.items_to_send.size() == server.items_to_receive); - BOOST_CHECK(server.items_to_send.size() == client.items_to_receive); + UNIT_TEST_CHECK(client.items_to_send.size() == server.items_to_receive); + UNIT_TEST_CHECK(server.items_to_send.size() == client.items_to_receive); L(FL("stats: %d total, %d cs, %d sc, %d msgs") % (server.items_to_send.size() + client.get_local_items().size()) % client.items_to_send.size() @@ -569,7 +569,7 @@ refiner_pair L(FL("WARNING: %s transmission will send redundant item %s") % context % hid); } - BOOST_CHECK(j == dst.end()); + UNIT_TEST_CHECK(j == dst.end()); } } @@ -583,7 +583,7 @@ refiner_pair "diff(local,peer)", tmp, "items_to_send", r.items_to_send); - BOOST_CHECK(tmp == r.items_to_send); + UNIT_TEST_CHECK(tmp == r.items_to_send); } }; ============================================================ --- restrictions.cc 3b059a0327f0bea5958a1eecfb2bbe9a3c525e10 +++ restrictions.cc 9c67575a229df8b944b5da5a7a6721c40588f92d @@ -581,61 +581,61 @@ UNIT_TEST(restrictions, empty_restrictio node_restriction nmask; - BOOST_CHECK(nmask.empty()); + UNIT_TEST_CHECK(nmask.empty()); - BOOST_CHECK(nmask.includes(roster, nid_root)); - BOOST_CHECK(nmask.includes(roster, nid_f)); - BOOST_CHECK(nmask.includes(roster, nid_g)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_root)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_f)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_g)); - BOOST_CHECK(nmask.includes(roster, nid_x)); - BOOST_CHECK(nmask.includes(roster, nid_xf)); - BOOST_CHECK(nmask.includes(roster, nid_xg)); - BOOST_CHECK(nmask.includes(roster, nid_xx)); - BOOST_CHECK(nmask.includes(roster, nid_xxf)); - BOOST_CHECK(nmask.includes(roster, nid_xxg)); - BOOST_CHECK(nmask.includes(roster, nid_xy)); - BOOST_CHECK(nmask.includes(roster, nid_xyf)); - BOOST_CHECK(nmask.includes(roster, nid_xyg)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_x)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_xf)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_xg)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_xx)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_xxf)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_xxg)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_xy)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_xyf)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_xyg)); - BOOST_CHECK(nmask.includes(roster, nid_y)); - BOOST_CHECK(nmask.includes(roster, nid_yf)); - BOOST_CHECK(nmask.includes(roster, nid_yg)); - BOOST_CHECK(nmask.includes(roster, nid_yx)); - BOOST_CHECK(nmask.includes(roster, nid_yxf)); - BOOST_CHECK(nmask.includes(roster, nid_yxg)); - BOOST_CHECK(nmask.includes(roster, nid_yy)); - BOOST_CHECK(nmask.includes(roster, nid_yyf)); - BOOST_CHECK(nmask.includes(roster, nid_yyg)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_y)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_yf)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_yg)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_yx)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_yxf)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_yxg)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_yy)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_yyf)); + UNIT_TEST_CHECK(nmask.includes(roster, nid_yyg)); // check restricted paths path_restriction pmask; - BOOST_CHECK(pmask.empty()); + UNIT_TEST_CHECK(pmask.empty()); - BOOST_CHECK(pmask.includes(sp_root)); - BOOST_CHECK(pmask.includes(sp_f)); - BOOST_CHECK(pmask.includes(sp_g)); + UNIT_TEST_CHECK(pmask.includes(sp_root)); + UNIT_TEST_CHECK(pmask.includes(sp_f)); + UNIT_TEST_CHECK(pmask.includes(sp_g)); - BOOST_CHECK(pmask.includes(sp_x)); - BOOST_CHECK(pmask.includes(sp_xf)); - BOOST_CHECK(pmask.includes(sp_xg)); - BOOST_CHECK(pmask.includes(sp_xx)); - BOOST_CHECK(pmask.includes(sp_xxf)); - BOOST_CHECK(pmask.includes(sp_xxg)); - BOOST_CHECK(pmask.includes(sp_xy)); - BOOST_CHECK(pmask.includes(sp_xyf)); - BOOST_CHECK(pmask.includes(sp_xyg)); + UNIT_TEST_CHECK(pmask.includes(sp_x)); + UNIT_TEST_CHECK(pmask.includes(sp_xf)); + UNIT_TEST_CHECK(pmask.includes(sp_xg)); + UNIT_TEST_CHECK(pmask.includes(sp_xx)); + UNIT_TEST_CHECK(pmask.includes(sp_xxf)); + UNIT_TEST_CHECK(pmask.includes(sp_xxg)); + UNIT_TEST_CHECK(pmask.includes(sp_xy)); + UNIT_TEST_CHECK(pmask.includes(sp_xyf)); + UNIT_TEST_CHECK(pmask.includes(sp_xyg)); - BOOST_CHECK(pmask.includes(sp_y)); - BOOST_CHECK(pmask.includes(sp_yf)); - BOOST_CHECK(pmask.includes(sp_yg)); - BOOST_CHECK(pmask.includes(sp_yx)); - BOOST_CHECK(pmask.includes(sp_yxf)); - BOOST_CHECK(pmask.includes(sp_yxg)); - BOOST_CHECK(pmask.includes(sp_yy)); - BOOST_CHECK(pmask.includes(sp_yyf)); - BOOST_CHECK(pmask.includes(sp_yyg)); + UNIT_TEST_CHECK(pmask.includes(sp_y)); + UNIT_TEST_CHECK(pmask.includes(sp_yf)); + UNIT_TEST_CHECK(pmask.includes(sp_yg)); + UNIT_TEST_CHECK(pmask.includes(sp_yx)); + UNIT_TEST_CHECK(pmask.includes(sp_yxf)); + UNIT_TEST_CHECK(pmask.includes(sp_yxg)); + UNIT_TEST_CHECK(pmask.includes(sp_yy)); + UNIT_TEST_CHECK(pmask.includes(sp_yyf)); + UNIT_TEST_CHECK(pmask.includes(sp_yyg)); } UNIT_TEST(restrictions, simple_include) @@ -653,61 +653,61 @@ UNIT_TEST(restrictions, simple_include) node_restriction nmask(includes, excludes, -1, roster, app); - BOOST_CHECK(!nmask.empty()); + UNIT_TEST_CHECK(!nmask.empty()); - BOOST_CHECK(!nmask.includes(roster, nid_root)); - BOOST_CHECK(!nmask.includes(roster, nid_f)); - BOOST_CHECK(!nmask.includes(roster, nid_g)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_root)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_f)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_g)); - BOOST_CHECK(!nmask.includes(roster, nid_x)); - BOOST_CHECK(!nmask.includes(roster, nid_xf)); - BOOST_CHECK(!nmask.includes(roster, nid_xg)); - BOOST_CHECK( nmask.includes(roster, nid_xx)); - BOOST_CHECK( nmask.includes(roster, nid_xxf)); - BOOST_CHECK( nmask.includes(roster, nid_xxg)); - BOOST_CHECK(!nmask.includes(roster, nid_xy)); - BOOST_CHECK(!nmask.includes(roster, nid_xyf)); - BOOST_CHECK(!nmask.includes(roster, nid_xyg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_x)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xx)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xxf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xxg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xy)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xyf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xyg)); - BOOST_CHECK(!nmask.includes(roster, nid_y)); - BOOST_CHECK(!nmask.includes(roster, nid_yf)); - BOOST_CHECK(!nmask.includes(roster, nid_yg)); - BOOST_CHECK(!nmask.includes(roster, nid_yx)); - BOOST_CHECK(!nmask.includes(roster, nid_yxf)); - BOOST_CHECK(!nmask.includes(roster, nid_yxg)); - BOOST_CHECK( nmask.includes(roster, nid_yy)); - BOOST_CHECK( nmask.includes(roster, nid_yyf)); - BOOST_CHECK( nmask.includes(roster, nid_yyg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_y)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yx)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yxf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yxg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yy)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yyf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yyg)); // check restricted paths path_restriction pmask(includes, excludes, -1, app); - BOOST_CHECK(!pmask.empty()); + UNIT_TEST_CHECK(!pmask.empty()); - BOOST_CHECK(!pmask.includes(sp_root)); - BOOST_CHECK(!pmask.includes(sp_f)); - BOOST_CHECK(!pmask.includes(sp_g)); + UNIT_TEST_CHECK(!pmask.includes(sp_root)); + UNIT_TEST_CHECK(!pmask.includes(sp_f)); + UNIT_TEST_CHECK(!pmask.includes(sp_g)); - BOOST_CHECK(!pmask.includes(sp_x)); - BOOST_CHECK(!pmask.includes(sp_xf)); - BOOST_CHECK(!pmask.includes(sp_xg)); - BOOST_CHECK( pmask.includes(sp_xx)); - BOOST_CHECK( pmask.includes(sp_xxf)); - BOOST_CHECK( pmask.includes(sp_xxg)); - BOOST_CHECK(!pmask.includes(sp_xy)); - BOOST_CHECK(!pmask.includes(sp_xyf)); - BOOST_CHECK(!pmask.includes(sp_xyg)); + UNIT_TEST_CHECK(!pmask.includes(sp_x)); + UNIT_TEST_CHECK(!pmask.includes(sp_xf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xg)); + UNIT_TEST_CHECK( pmask.includes(sp_xx)); + UNIT_TEST_CHECK( pmask.includes(sp_xxf)); + UNIT_TEST_CHECK( pmask.includes(sp_xxg)); + UNIT_TEST_CHECK(!pmask.includes(sp_xy)); + UNIT_TEST_CHECK(!pmask.includes(sp_xyf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xyg)); - BOOST_CHECK(!pmask.includes(sp_y)); - BOOST_CHECK(!pmask.includes(sp_yf)); - BOOST_CHECK(!pmask.includes(sp_yg)); - BOOST_CHECK(!pmask.includes(sp_yx)); - BOOST_CHECK(!pmask.includes(sp_yxf)); - BOOST_CHECK(!pmask.includes(sp_yxg)); - BOOST_CHECK( pmask.includes(sp_yy)); - BOOST_CHECK( pmask.includes(sp_yyf)); - BOOST_CHECK( pmask.includes(sp_yyg)); + UNIT_TEST_CHECK(!pmask.includes(sp_y)); + UNIT_TEST_CHECK(!pmask.includes(sp_yf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yg)); + UNIT_TEST_CHECK(!pmask.includes(sp_yx)); + UNIT_TEST_CHECK(!pmask.includes(sp_yxf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yxg)); + UNIT_TEST_CHECK( pmask.includes(sp_yy)); + UNIT_TEST_CHECK( pmask.includes(sp_yyf)); + UNIT_TEST_CHECK( pmask.includes(sp_yyg)); } UNIT_TEST(restrictions, simple_exclude) @@ -725,61 +725,61 @@ UNIT_TEST(restrictions, simple_exclude) node_restriction nmask(includes, excludes, -1, roster, app); - BOOST_CHECK(!nmask.empty()); + UNIT_TEST_CHECK(!nmask.empty()); - BOOST_CHECK( nmask.includes(roster, nid_root)); - BOOST_CHECK( nmask.includes(roster, nid_f)); - BOOST_CHECK( nmask.includes(roster, nid_g)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_root)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_f)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_g)); - BOOST_CHECK( nmask.includes(roster, nid_x)); - BOOST_CHECK( nmask.includes(roster, nid_xf)); - BOOST_CHECK( nmask.includes(roster, nid_xg)); - BOOST_CHECK(!nmask.includes(roster, nid_xx)); - BOOST_CHECK(!nmask.includes(roster, nid_xxf)); - BOOST_CHECK(!nmask.includes(roster, nid_xxg)); - BOOST_CHECK( nmask.includes(roster, nid_xy)); - BOOST_CHECK( nmask.includes(roster, nid_xyf)); - BOOST_CHECK( nmask.includes(roster, nid_xyg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_x)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xx)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xxf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xxg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xy)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xyf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xyg)); - BOOST_CHECK( nmask.includes(roster, nid_y)); - BOOST_CHECK( nmask.includes(roster, nid_yf)); - BOOST_CHECK( nmask.includes(roster, nid_yg)); - BOOST_CHECK( nmask.includes(roster, nid_yx)); - BOOST_CHECK( nmask.includes(roster, nid_yxf)); - BOOST_CHECK( nmask.includes(roster, nid_yxg)); - BOOST_CHECK(!nmask.includes(roster, nid_yy)); - BOOST_CHECK(!nmask.includes(roster, nid_yyf)); - BOOST_CHECK(!nmask.includes(roster, nid_yyg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_y)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yx)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yxf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yxg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yy)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yyf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yyg)); // check restricted paths path_restriction pmask(includes, excludes, -1, app); - BOOST_CHECK(!pmask.empty()); + UNIT_TEST_CHECK(!pmask.empty()); - BOOST_CHECK( pmask.includes(sp_root)); - BOOST_CHECK( pmask.includes(sp_f)); - BOOST_CHECK( pmask.includes(sp_g)); + UNIT_TEST_CHECK( pmask.includes(sp_root)); + UNIT_TEST_CHECK( pmask.includes(sp_f)); + UNIT_TEST_CHECK( pmask.includes(sp_g)); - BOOST_CHECK( pmask.includes(sp_x)); - BOOST_CHECK( pmask.includes(sp_xf)); - BOOST_CHECK( pmask.includes(sp_xg)); - BOOST_CHECK(!pmask.includes(sp_xx)); - BOOST_CHECK(!pmask.includes(sp_xxf)); - BOOST_CHECK(!pmask.includes(sp_xxg)); - BOOST_CHECK( pmask.includes(sp_xy)); - BOOST_CHECK( pmask.includes(sp_xyf)); - BOOST_CHECK( pmask.includes(sp_xyg)); + UNIT_TEST_CHECK( pmask.includes(sp_x)); + UNIT_TEST_CHECK( pmask.includes(sp_xf)); + UNIT_TEST_CHECK( pmask.includes(sp_xg)); + UNIT_TEST_CHECK(!pmask.includes(sp_xx)); + UNIT_TEST_CHECK(!pmask.includes(sp_xxf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xxg)); + UNIT_TEST_CHECK( pmask.includes(sp_xy)); + UNIT_TEST_CHECK( pmask.includes(sp_xyf)); + UNIT_TEST_CHECK( pmask.includes(sp_xyg)); - BOOST_CHECK( pmask.includes(sp_y)); - BOOST_CHECK( pmask.includes(sp_yf)); - BOOST_CHECK( pmask.includes(sp_yg)); - BOOST_CHECK( pmask.includes(sp_yx)); - BOOST_CHECK( pmask.includes(sp_yxf)); - BOOST_CHECK( pmask.includes(sp_yxg)); - BOOST_CHECK(!pmask.includes(sp_yy)); - BOOST_CHECK(!pmask.includes(sp_yyf)); - BOOST_CHECK(!pmask.includes(sp_yyg)); + UNIT_TEST_CHECK( pmask.includes(sp_y)); + UNIT_TEST_CHECK( pmask.includes(sp_yf)); + UNIT_TEST_CHECK( pmask.includes(sp_yg)); + UNIT_TEST_CHECK( pmask.includes(sp_yx)); + UNIT_TEST_CHECK( pmask.includes(sp_yxf)); + UNIT_TEST_CHECK( pmask.includes(sp_yxg)); + UNIT_TEST_CHECK(!pmask.includes(sp_yy)); + UNIT_TEST_CHECK(!pmask.includes(sp_yyf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yyg)); } UNIT_TEST(restrictions, include_exclude) @@ -799,61 +799,61 @@ UNIT_TEST(restrictions, include_exclude) node_restriction nmask(includes, excludes, -1, roster, app); - BOOST_CHECK(!nmask.empty()); + UNIT_TEST_CHECK(!nmask.empty()); - BOOST_CHECK(!nmask.includes(roster, nid_root)); - BOOST_CHECK(!nmask.includes(roster, nid_f)); - BOOST_CHECK(!nmask.includes(roster, nid_g)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_root)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_f)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_g)); - BOOST_CHECK( nmask.includes(roster, nid_x)); - BOOST_CHECK( nmask.includes(roster, nid_xf)); - BOOST_CHECK( nmask.includes(roster, nid_xg)); - BOOST_CHECK(!nmask.includes(roster, nid_xx)); - BOOST_CHECK(!nmask.includes(roster, nid_xxf)); - BOOST_CHECK(!nmask.includes(roster, nid_xxg)); - BOOST_CHECK( nmask.includes(roster, nid_xy)); - BOOST_CHECK( nmask.includes(roster, nid_xyf)); - BOOST_CHECK( nmask.includes(roster, nid_xyg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_x)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xx)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xxf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xxg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xy)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xyf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xyg)); - BOOST_CHECK( nmask.includes(roster, nid_y)); - BOOST_CHECK( nmask.includes(roster, nid_yf)); - BOOST_CHECK( nmask.includes(roster, nid_yg)); - BOOST_CHECK( nmask.includes(roster, nid_yx)); - BOOST_CHECK( nmask.includes(roster, nid_yxf)); - BOOST_CHECK( nmask.includes(roster, nid_yxg)); - BOOST_CHECK(!nmask.includes(roster, nid_yy)); - BOOST_CHECK(!nmask.includes(roster, nid_yyf)); - BOOST_CHECK(!nmask.includes(roster, nid_yyg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_y)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yx)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yxf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yxg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yy)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yyf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yyg)); // check restricted paths path_restriction pmask(includes, excludes, -1, app); - BOOST_CHECK(!pmask.empty()); + UNIT_TEST_CHECK(!pmask.empty()); - BOOST_CHECK(!pmask.includes(sp_root)); - BOOST_CHECK(!pmask.includes(sp_f)); - BOOST_CHECK(!pmask.includes(sp_g)); + UNIT_TEST_CHECK(!pmask.includes(sp_root)); + UNIT_TEST_CHECK(!pmask.includes(sp_f)); + UNIT_TEST_CHECK(!pmask.includes(sp_g)); - BOOST_CHECK( pmask.includes(sp_x)); - BOOST_CHECK( pmask.includes(sp_xf)); - BOOST_CHECK( pmask.includes(sp_xg)); - BOOST_CHECK(!pmask.includes(sp_xx)); - BOOST_CHECK(!pmask.includes(sp_xxf)); - BOOST_CHECK(!pmask.includes(sp_xxg)); - BOOST_CHECK( pmask.includes(sp_xy)); - BOOST_CHECK( pmask.includes(sp_xyf)); - BOOST_CHECK( pmask.includes(sp_xyg)); + UNIT_TEST_CHECK( pmask.includes(sp_x)); + UNIT_TEST_CHECK( pmask.includes(sp_xf)); + UNIT_TEST_CHECK( pmask.includes(sp_xg)); + UNIT_TEST_CHECK(!pmask.includes(sp_xx)); + UNIT_TEST_CHECK(!pmask.includes(sp_xxf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xxg)); + UNIT_TEST_CHECK( pmask.includes(sp_xy)); + UNIT_TEST_CHECK( pmask.includes(sp_xyf)); + UNIT_TEST_CHECK( pmask.includes(sp_xyg)); - BOOST_CHECK( pmask.includes(sp_y)); - BOOST_CHECK( pmask.includes(sp_yf)); - BOOST_CHECK( pmask.includes(sp_yg)); - BOOST_CHECK( pmask.includes(sp_yx)); - BOOST_CHECK( pmask.includes(sp_yxf)); - BOOST_CHECK( pmask.includes(sp_yxg)); - BOOST_CHECK(!pmask.includes(sp_yy)); - BOOST_CHECK(!pmask.includes(sp_yyf)); - BOOST_CHECK(!pmask.includes(sp_yyg)); + UNIT_TEST_CHECK( pmask.includes(sp_y)); + UNIT_TEST_CHECK( pmask.includes(sp_yf)); + UNIT_TEST_CHECK( pmask.includes(sp_yg)); + UNIT_TEST_CHECK( pmask.includes(sp_yx)); + UNIT_TEST_CHECK( pmask.includes(sp_yxf)); + UNIT_TEST_CHECK( pmask.includes(sp_yxg)); + UNIT_TEST_CHECK(!pmask.includes(sp_yy)); + UNIT_TEST_CHECK(!pmask.includes(sp_yyf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yyg)); } UNIT_TEST(restrictions, exclude_include) @@ -876,61 +876,61 @@ UNIT_TEST(restrictions, exclude_include) node_restriction nmask(includes, excludes, -1, roster, app); - BOOST_CHECK(!nmask.empty()); + UNIT_TEST_CHECK(!nmask.empty()); - BOOST_CHECK(!nmask.includes(roster, nid_root)); - BOOST_CHECK(!nmask.includes(roster, nid_f)); - BOOST_CHECK(!nmask.includes(roster, nid_g)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_root)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_f)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_g)); - BOOST_CHECK(!nmask.includes(roster, nid_x)); - BOOST_CHECK(!nmask.includes(roster, nid_xf)); - BOOST_CHECK(!nmask.includes(roster, nid_xg)); - BOOST_CHECK( nmask.includes(roster, nid_xx)); - BOOST_CHECK( nmask.includes(roster, nid_xxf)); - BOOST_CHECK( nmask.includes(roster, nid_xxg)); - BOOST_CHECK(!nmask.includes(roster, nid_xy)); - BOOST_CHECK(!nmask.includes(roster, nid_xyf)); - BOOST_CHECK(!nmask.includes(roster, nid_xyg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_x)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xx)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xxf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xxg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xy)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xyf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xyg)); - BOOST_CHECK(!nmask.includes(roster, nid_y)); - BOOST_CHECK(!nmask.includes(roster, nid_yf)); - BOOST_CHECK(!nmask.includes(roster, nid_yg)); - BOOST_CHECK(!nmask.includes(roster, nid_yx)); - BOOST_CHECK(!nmask.includes(roster, nid_yxf)); - BOOST_CHECK(!nmask.includes(roster, nid_yxg)); - BOOST_CHECK( nmask.includes(roster, nid_yy)); - BOOST_CHECK( nmask.includes(roster, nid_yyf)); - BOOST_CHECK( nmask.includes(roster, nid_yyg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_y)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yx)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yxf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yxg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yy)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yyf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yyg)); // check restricted paths path_restriction pmask(includes, excludes, -1, app); - BOOST_CHECK(!pmask.empty()); + UNIT_TEST_CHECK(!pmask.empty()); - BOOST_CHECK(!pmask.includes(sp_root)); - BOOST_CHECK(!pmask.includes(sp_f)); - BOOST_CHECK(!pmask.includes(sp_g)); + UNIT_TEST_CHECK(!pmask.includes(sp_root)); + UNIT_TEST_CHECK(!pmask.includes(sp_f)); + UNIT_TEST_CHECK(!pmask.includes(sp_g)); - BOOST_CHECK(!pmask.includes(sp_x)); - BOOST_CHECK(!pmask.includes(sp_xf)); - BOOST_CHECK(!pmask.includes(sp_xg)); - BOOST_CHECK( pmask.includes(sp_xx)); - BOOST_CHECK( pmask.includes(sp_xxf)); - BOOST_CHECK( pmask.includes(sp_xxg)); - BOOST_CHECK(!pmask.includes(sp_xy)); - BOOST_CHECK(!pmask.includes(sp_xyf)); - BOOST_CHECK(!pmask.includes(sp_xyg)); + UNIT_TEST_CHECK(!pmask.includes(sp_x)); + UNIT_TEST_CHECK(!pmask.includes(sp_xf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xg)); + UNIT_TEST_CHECK( pmask.includes(sp_xx)); + UNIT_TEST_CHECK( pmask.includes(sp_xxf)); + UNIT_TEST_CHECK( pmask.includes(sp_xxg)); + UNIT_TEST_CHECK(!pmask.includes(sp_xy)); + UNIT_TEST_CHECK(!pmask.includes(sp_xyf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xyg)); - BOOST_CHECK(!pmask.includes(sp_y)); - BOOST_CHECK(!pmask.includes(sp_yf)); - BOOST_CHECK(!pmask.includes(sp_yg)); - BOOST_CHECK(!pmask.includes(sp_yx)); - BOOST_CHECK(!pmask.includes(sp_yxf)); - BOOST_CHECK(!pmask.includes(sp_yxg)); - BOOST_CHECK( pmask.includes(sp_yy)); - BOOST_CHECK( pmask.includes(sp_yyf)); - BOOST_CHECK( pmask.includes(sp_yyg)); + UNIT_TEST_CHECK(!pmask.includes(sp_y)); + UNIT_TEST_CHECK(!pmask.includes(sp_yf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yg)); + UNIT_TEST_CHECK(!pmask.includes(sp_yx)); + UNIT_TEST_CHECK(!pmask.includes(sp_yxf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yxg)); + UNIT_TEST_CHECK( pmask.includes(sp_yy)); + UNIT_TEST_CHECK( pmask.includes(sp_yyf)); + UNIT_TEST_CHECK( pmask.includes(sp_yyg)); } UNIT_TEST(restrictions, invalid_roster_paths) @@ -943,7 +943,7 @@ UNIT_TEST(restrictions, invalid_roster_p excludes.push_back(file_path_internal("bar")); app_state app; - BOOST_CHECK_THROW(node_restriction(includes, excludes, -1, roster, app), + UNIT_TEST_CHECK_THROW(node_restriction(includes, excludes, -1, roster, app), informative_failure); } @@ -957,7 +957,7 @@ UNIT_TEST(restrictions, invalid_workspac excludes.push_back(file_path_internal("bar")); app_state app; - BOOST_CHECK_THROW(path_restriction(includes, excludes, -1, app), + UNIT_TEST_CHECK_THROW(path_restriction(includes, excludes, -1, app), informative_failure); } @@ -980,61 +980,61 @@ UNIT_TEST(restrictions, include_depth_0) node_restriction nmask(includes, excludes, depth, roster, app); - BOOST_CHECK(!nmask.empty()); + UNIT_TEST_CHECK(!nmask.empty()); - BOOST_CHECK(!nmask.includes(roster, nid_root)); - BOOST_CHECK(!nmask.includes(roster, nid_f)); - BOOST_CHECK(!nmask.includes(roster, nid_g)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_root)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_f)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_g)); - BOOST_CHECK( nmask.includes(roster, nid_x)); - BOOST_CHECK( nmask.includes(roster, nid_xf)); - BOOST_CHECK( nmask.includes(roster, nid_xg)); - BOOST_CHECK( nmask.includes(roster, nid_xx)); - BOOST_CHECK(!nmask.includes(roster, nid_xxf)); - BOOST_CHECK(!nmask.includes(roster, nid_xxg)); - BOOST_CHECK( nmask.includes(roster, nid_xy)); - BOOST_CHECK(!nmask.includes(roster, nid_xyf)); - BOOST_CHECK(!nmask.includes(roster, nid_xyg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_x)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xx)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xxf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xxg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xy)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xyf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xyg)); - BOOST_CHECK( nmask.includes(roster, nid_y)); - BOOST_CHECK( nmask.includes(roster, nid_yf)); - BOOST_CHECK( nmask.includes(roster, nid_yg)); - BOOST_CHECK( nmask.includes(roster, nid_yx)); - BOOST_CHECK(!nmask.includes(roster, nid_yxf)); - BOOST_CHECK(!nmask.includes(roster, nid_yxg)); - BOOST_CHECK( nmask.includes(roster, nid_yy)); - BOOST_CHECK(!nmask.includes(roster, nid_yyf)); - BOOST_CHECK(!nmask.includes(roster, nid_yyg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_y)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yx)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yxf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yxg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yy)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yyf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yyg)); // check restricted paths path_restriction pmask(includes, excludes, depth, app); - BOOST_CHECK(!pmask.empty()); + UNIT_TEST_CHECK(!pmask.empty()); - BOOST_CHECK(!pmask.includes(sp_root)); - BOOST_CHECK(!pmask.includes(sp_f)); - BOOST_CHECK(!pmask.includes(sp_g)); + UNIT_TEST_CHECK(!pmask.includes(sp_root)); + UNIT_TEST_CHECK(!pmask.includes(sp_f)); + UNIT_TEST_CHECK(!pmask.includes(sp_g)); - BOOST_CHECK( pmask.includes(sp_x)); - BOOST_CHECK( pmask.includes(sp_xf)); - BOOST_CHECK( pmask.includes(sp_xg)); - BOOST_CHECK( pmask.includes(sp_xx)); - BOOST_CHECK(!pmask.includes(sp_xxf)); - BOOST_CHECK(!pmask.includes(sp_xxg)); - BOOST_CHECK( pmask.includes(sp_xy)); - BOOST_CHECK(!pmask.includes(sp_xyf)); - BOOST_CHECK(!pmask.includes(sp_xyg)); + UNIT_TEST_CHECK( pmask.includes(sp_x)); + UNIT_TEST_CHECK( pmask.includes(sp_xf)); + UNIT_TEST_CHECK( pmask.includes(sp_xg)); + UNIT_TEST_CHECK( pmask.includes(sp_xx)); + UNIT_TEST_CHECK(!pmask.includes(sp_xxf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xxg)); + UNIT_TEST_CHECK( pmask.includes(sp_xy)); + UNIT_TEST_CHECK(!pmask.includes(sp_xyf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xyg)); - BOOST_CHECK( pmask.includes(sp_y)); - BOOST_CHECK( pmask.includes(sp_yf)); - BOOST_CHECK( pmask.includes(sp_yg)); - BOOST_CHECK( pmask.includes(sp_yx)); - BOOST_CHECK(!pmask.includes(sp_yxf)); - BOOST_CHECK(!pmask.includes(sp_yxg)); - BOOST_CHECK( pmask.includes(sp_yy)); - BOOST_CHECK(!pmask.includes(sp_yyf)); - BOOST_CHECK(!pmask.includes(sp_yyg)); + UNIT_TEST_CHECK( pmask.includes(sp_y)); + UNIT_TEST_CHECK( pmask.includes(sp_yf)); + UNIT_TEST_CHECK( pmask.includes(sp_yg)); + UNIT_TEST_CHECK( pmask.includes(sp_yx)); + UNIT_TEST_CHECK(!pmask.includes(sp_yxf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yxg)); + UNIT_TEST_CHECK( pmask.includes(sp_yy)); + UNIT_TEST_CHECK(!pmask.includes(sp_yyf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yyg)); } UNIT_TEST(restrictions, include_depth_0_empty_restriction) @@ -1054,61 +1054,61 @@ UNIT_TEST(restrictions, include_depth_0_ node_restriction nmask(includes, excludes, depth, roster, app); - BOOST_CHECK( nmask.empty()); + UNIT_TEST_CHECK( nmask.empty()); - BOOST_CHECK( nmask.includes(roster, nid_root)); - BOOST_CHECK( nmask.includes(roster, nid_f)); - BOOST_CHECK( nmask.includes(roster, nid_g)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_root)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_f)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_g)); - BOOST_CHECK( nmask.includes(roster, nid_x)); - BOOST_CHECK(!nmask.includes(roster, nid_xf)); - BOOST_CHECK(!nmask.includes(roster, nid_xg)); - BOOST_CHECK(!nmask.includes(roster, nid_xx)); - BOOST_CHECK(!nmask.includes(roster, nid_xxf)); - BOOST_CHECK(!nmask.includes(roster, nid_xxg)); - BOOST_CHECK(!nmask.includes(roster, nid_xy)); - BOOST_CHECK(!nmask.includes(roster, nid_xyf)); - BOOST_CHECK(!nmask.includes(roster, nid_xyg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_x)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xx)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xxf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xxg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xy)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xyf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_xyg)); - BOOST_CHECK( nmask.includes(roster, nid_y)); - BOOST_CHECK(!nmask.includes(roster, nid_yf)); - BOOST_CHECK(!nmask.includes(roster, nid_yg)); - BOOST_CHECK(!nmask.includes(roster, nid_yx)); - BOOST_CHECK(!nmask.includes(roster, nid_yxf)); - BOOST_CHECK(!nmask.includes(roster, nid_yxg)); - BOOST_CHECK(!nmask.includes(roster, nid_yy)); - BOOST_CHECK(!nmask.includes(roster, nid_yyf)); - BOOST_CHECK(!nmask.includes(roster, nid_yyg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_y)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yx)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yxf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yxg)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yy)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yyf)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_yyg)); // check restricted paths path_restriction pmask(includes, excludes, depth, app); - BOOST_CHECK( pmask.empty()); + UNIT_TEST_CHECK( pmask.empty()); - BOOST_CHECK( pmask.includes(sp_root)); - BOOST_CHECK( pmask.includes(sp_f)); - BOOST_CHECK( pmask.includes(sp_g)); + UNIT_TEST_CHECK( pmask.includes(sp_root)); + UNIT_TEST_CHECK( pmask.includes(sp_f)); + UNIT_TEST_CHECK( pmask.includes(sp_g)); - BOOST_CHECK( pmask.includes(sp_x)); - BOOST_CHECK(!pmask.includes(sp_xf)); - BOOST_CHECK(!pmask.includes(sp_xg)); - BOOST_CHECK(!pmask.includes(sp_xx)); - BOOST_CHECK(!pmask.includes(sp_xxf)); - BOOST_CHECK(!pmask.includes(sp_xxg)); - BOOST_CHECK(!pmask.includes(sp_xy)); - BOOST_CHECK(!pmask.includes(sp_xyf)); - BOOST_CHECK(!pmask.includes(sp_xyg)); + UNIT_TEST_CHECK( pmask.includes(sp_x)); + UNIT_TEST_CHECK(!pmask.includes(sp_xf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xg)); + UNIT_TEST_CHECK(!pmask.includes(sp_xx)); + UNIT_TEST_CHECK(!pmask.includes(sp_xxf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xxg)); + UNIT_TEST_CHECK(!pmask.includes(sp_xy)); + UNIT_TEST_CHECK(!pmask.includes(sp_xyf)); + UNIT_TEST_CHECK(!pmask.includes(sp_xyg)); - BOOST_CHECK( pmask.includes(sp_y)); - BOOST_CHECK(!pmask.includes(sp_yf)); - BOOST_CHECK(!pmask.includes(sp_yg)); - BOOST_CHECK(!pmask.includes(sp_yx)); - BOOST_CHECK(!pmask.includes(sp_yxf)); - BOOST_CHECK(!pmask.includes(sp_yxg)); - BOOST_CHECK(!pmask.includes(sp_yy)); - BOOST_CHECK(!pmask.includes(sp_yyf)); - BOOST_CHECK(!pmask.includes(sp_yyg)); + UNIT_TEST_CHECK( pmask.includes(sp_y)); + UNIT_TEST_CHECK(!pmask.includes(sp_yf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yg)); + UNIT_TEST_CHECK(!pmask.includes(sp_yx)); + UNIT_TEST_CHECK(!pmask.includes(sp_yxf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yxg)); + UNIT_TEST_CHECK(!pmask.includes(sp_yy)); + UNIT_TEST_CHECK(!pmask.includes(sp_yyf)); + UNIT_TEST_CHECK(!pmask.includes(sp_yyg)); } UNIT_TEST(restrictions, include_depth_1) @@ -1130,61 +1130,61 @@ UNIT_TEST(restrictions, include_depth_1) node_restriction nmask(includes, excludes, depth, roster, app); - BOOST_CHECK(!nmask.empty()); + UNIT_TEST_CHECK(!nmask.empty()); - BOOST_CHECK(!nmask.includes(roster, nid_root)); - BOOST_CHECK(!nmask.includes(roster, nid_f)); - BOOST_CHECK(!nmask.includes(roster, nid_g)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_root)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_f)); + UNIT_TEST_CHECK(!nmask.includes(roster, nid_g)); - BOOST_CHECK( nmask.includes(roster, nid_x)); - BOOST_CHECK( nmask.includes(roster, nid_xf)); - BOOST_CHECK( nmask.includes(roster, nid_xg)); - BOOST_CHECK( nmask.includes(roster, nid_xx)); - BOOST_CHECK( nmask.includes(roster, nid_xxf)); - BOOST_CHECK( nmask.includes(roster, nid_xxg)); - BOOST_CHECK( nmask.includes(roster, nid_xy)); - BOOST_CHECK( nmask.includes(roster, nid_xyf)); - BOOST_CHECK( nmask.includes(roster, nid_xyg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_x)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xx)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xxf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xxg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xy)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xyf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_xyg)); - BOOST_CHECK( nmask.includes(roster, nid_y)); - BOOST_CHECK( nmask.includes(roster, nid_yf)); - BOOST_CHECK( nmask.includes(roster, nid_yg)); - BOOST_CHECK( nmask.includes(roster, nid_yx)); - BOOST_CHECK( nmask.includes(roster, nid_yxf)); - BOOST_CHECK( nmask.includes(roster, nid_yxg)); - BOOST_CHECK( nmask.includes(roster, nid_yy)); - BOOST_CHECK( nmask.includes(roster, nid_yyf)); - BOOST_CHECK( nmask.includes(roster, nid_yyg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_y)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yx)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yxf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yxg)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yy)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yyf)); + UNIT_TEST_CHECK( nmask.includes(roster, nid_yyg)); // check restricted paths path_restriction pmask(includes, excludes, depth, app); - BOOST_CHECK(!pmask.empty()); + UNIT_TEST_CHECK(!pmask.empty()); - BOOST_CHECK(!pmask.includes(sp_root)); - BOOST_CHECK(!pmask.includes(sp_f)); - BOOST_CHECK(!pmask.includes(sp_g)); + UNIT_TEST_CHECK(!pmask.includes(sp_root)); + UNIT_TEST_CHECK(!pmask.includes(sp_f)); + UNIT_TEST_CHECK(!pmask.includes(sp_g)); - BOOST_CHECK( pmask.includes(sp_x)); - BOOST_CHECK( pmask.includes(sp_xf)); - BOOST_CHECK( pmask.includes(sp_xg)); - BOOST_CHECK( pmask.includes(sp_xx)); - BOOST_CHECK( pmask.includes(sp_xxf)); - BOOST_CHECK( pmask.includes(sp_xxg)); - BOOST_CHECK( pmask.includes(sp_xy)); - BOOST_CHECK( pmask.includes(sp_xyf)); - BOOST_CHECK( pmask.includes(sp_xyg)); + UNIT_TEST_CHECK( pmask.includes(sp_x)); + UNIT_TEST_CHECK( pmask.includes(sp_xf)); + UNIT_TEST_CHECK( pmask.includes(sp_xg)); + UNIT_TEST_CHECK( pmask.includes(sp_xx)); + UNIT_TEST_CHECK( pmask.includes(sp_xxf)); + UNIT_TEST_CHECK( pmask.includes(sp_xxg)); + UNIT_TEST_CHECK( pmask.includes(sp_xy)); + UNIT_TEST_CHECK( pmask.includes(sp_xyf)); + UNIT_TEST_CHECK( pmask.includes(sp_xyg)); - BOOST_CHECK( pmask.includes(sp_y)); - BOOST_CHECK( pmask.includes(sp_yf)); - BOOST_CHECK( pmask.includes(sp_yg)); - BOOST_CHECK( pmask.includes(sp_yx)); - BOOST_CHECK( pmask.includes(sp_yxf)); - BOOST_CHECK( pmask.includes(sp_yxg)); - BOOST_CHECK( pmask.includes(sp_yy)); - BOOST_CHECK( pmask.includes(sp_yyf)); - BOOST_CHECK( pmask.includes(sp_yyg)); + UNIT_TEST_CHECK( pmask.includes(sp_y)); + UNIT_TEST_CHECK( pmask.includes(sp_yf)); + UNIT_TEST_CHECK( pmask.includes(sp_yg)); + UNIT_TEST_CHECK( pmask.includes(sp_yx)); + UNIT_TEST_CHECK( pmask.includes(sp_yxf)); + UNIT_TEST_CHECK( pmask.includes(sp_yxg)); + UNIT_TEST_CHECK( pmask.includes(sp_yy)); + UNIT_TEST_CHECK( pmask.includes(sp_yyf)); + UNIT_TEST_CHECK( pmask.includes(sp_yyg)); } #endif // BUILD_UNIT_TESTS ============================================================ --- rev_height.cc f44979ce3c7ba571c00cf0c810991aec9f7f84fa +++ rev_height.cc a44fcd6a6619cd1b8b187674abdd07793f146023 @@ -127,7 +127,7 @@ UNIT_TEST(rev_height, count_up) I(read_at(h(), 0) == 0); I(read_at(h(), 1) == 0); I(read_at(h(), 2) == 0); - BOOST_CHECK_THROW(read_at(h(), 3), std::out_of_range); + UNIT_TEST_CHECK_THROW(read_at(h(), 3), std::out_of_range); for (u32 n = 1; n < 10000; n++) { ============================================================ --- roster.cc dfb22c69788162515c92abc16b52eee9c1e4f75e +++ roster.cc 48b29599a42af23853120572d56068ac1ebfd6fc @@ -3196,8 +3196,8 @@ check_sane_roster_do_tests(int to_run, i MM(r); // roster must have a root dir - MAYBE(BOOST_CHECK_THROW(r.check_sane(false), logic_error)); - MAYBE(BOOST_CHECK_THROW(r.check_sane(true), logic_error)); + MAYBE(UNIT_TEST_CHECK_THROW(r.check_sane(false), logic_error)); + MAYBE(UNIT_TEST_CHECK_THROW(r.check_sane(true), logic_error)); split_path sp_, sp_foo, sp_foo_bar, sp_foo_baz; file_path().split(sp_); @@ -3207,40 +3207,40 @@ check_sane_roster_do_tests(int to_run, i node_id nid_f = r.create_file_node(file_id(string("0000000000000000000000000000000000000000")), nis); // root must be a directory, not a file - MAYBE(BOOST_CHECK_THROW(r.attach_node(nid_f, sp_), logic_error)); + MAYBE(UNIT_TEST_CHECK_THROW(r.attach_node(nid_f, sp_), logic_error)); node_id root_dir = r.create_dir_node(nis); r.attach_node(root_dir, sp_); // has a root dir, but a detached file - MAYBE(BOOST_CHECK_THROW(r.check_sane(false), logic_error)); - MAYBE(BOOST_CHECK_THROW(r.check_sane(true), logic_error)); + MAYBE(UNIT_TEST_CHECK_THROW(r.check_sane(false), logic_error)); + MAYBE(UNIT_TEST_CHECK_THROW(r.check_sane(true), logic_error)); r.attach_node(nid_f, sp_foo); // now should be sane - BOOST_CHECK_NOT_THROW(r.check_sane(false), logic_error); - BOOST_CHECK_NOT_THROW(r.check_sane(true), logic_error); + UNIT_TEST_CHECK_NOT_THROW(r.check_sane(false), logic_error); + UNIT_TEST_CHECK_NOT_THROW(r.check_sane(true), logic_error); node_id nid_d = r.create_dir_node(nis); // if "foo" exists, can't attach another node at "foo" - MAYBE(BOOST_CHECK_THROW(r.attach_node(nid_d, sp_foo), logic_error)); + MAYBE(UNIT_TEST_CHECK_THROW(r.attach_node(nid_d, sp_foo), logic_error)); // if "foo" is a file, can't attach a node at "foo/bar" - MAYBE(BOOST_CHECK_THROW(r.attach_node(nid_d, sp_foo_bar), logic_error)); + MAYBE(UNIT_TEST_CHECK_THROW(r.attach_node(nid_d, sp_foo_bar), logic_error)); - BOOST_CHECK(r.detach_node(sp_foo) == nid_f); + UNIT_TEST_CHECK(r.detach_node(sp_foo) == nid_f); r.attach_node(nid_d, sp_foo); r.attach_node(nid_f, sp_foo_bar); - BOOST_CHECK_NOT_THROW(r.check_sane(false), logic_error); - BOOST_CHECK_NOT_THROW(r.check_sane(true), logic_error); + UNIT_TEST_CHECK_NOT_THROW(r.check_sane(false), logic_error); + UNIT_TEST_CHECK_NOT_THROW(r.check_sane(true), logic_error); temp_node_id_source nis_tmp; node_id nid_tmp = r.create_dir_node(nis_tmp); // has a detached node - MAYBE(BOOST_CHECK_THROW(r.check_sane(false), logic_error)); - MAYBE(BOOST_CHECK_THROW(r.check_sane(true), logic_error)); + MAYBE(UNIT_TEST_CHECK_THROW(r.check_sane(false), logic_error)); + MAYBE(UNIT_TEST_CHECK_THROW(r.check_sane(true), logic_error)); r.attach_node(nid_tmp, sp_foo_baz); // now has no detached nodes, but one temp node - MAYBE(BOOST_CHECK_THROW(r.check_sane(false), logic_error)); - BOOST_CHECK_NOT_THROW(r.check_sane(true), logic_error); + MAYBE(UNIT_TEST_CHECK_THROW(r.check_sane(false), logic_error)); + UNIT_TEST_CHECK_NOT_THROW(r.check_sane(true), logic_error); } #undef MAYBE @@ -3269,7 +3269,7 @@ UNIT_TEST(roster, check_sane_roster_loop node_id nid_bar = r.create_dir_node(nis); r.attach_node(nid_foo, nid_bar, foo_bar[1]); r.attach_node(nid_bar, nid_foo, foo_bar[2]); - BOOST_CHECK_THROW(r.check_sane(true), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane(true), logic_error); } UNIT_TEST(roster, check_sane_roster_screwy_dir_map) @@ -3284,18 +3284,18 @@ UNIT_TEST(roster, check_sane_roster_scre node_id other_nid = other.create_dir_node(nis); dir_t root_n = downcast_to_dir_t(r.get_node(root)); root_n->children.insert(make_pair(*(foo.end()-1), other.get_node(other_nid))); - BOOST_CHECK_THROW(r.check_sane(), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane(), logic_error); // well, but that one was easy, actually, because a dir traversal will hit // more nodes than actually exist... so let's make it harder, by making sure // that a dir traversal will hit exactly as many nodes as actually exist. node_id distractor_nid = r.create_dir_node(nis); - BOOST_CHECK_THROW(r.check_sane(), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane(), logic_error); // and even harder, by making that node superficially valid too dir_t distractor_n = downcast_to_dir_t(r.get_node(distractor_nid)); distractor_n->parent = distractor_nid; distractor_n->name = *(foo.end()-1); distractor_n->children.insert(make_pair(distractor_n->name, distractor_n)); - BOOST_CHECK_THROW(r.check_sane(), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane(), logic_error); } UNIT_TEST(roster, bad_attr) @@ -3305,14 +3305,14 @@ UNIT_TEST(roster, bad_attr) split_path root; file_path().split(root); r.attach_node(r.create_dir_node(nis), root); - BOOST_CHECK_THROW(r.set_attr(root, attr_key("test_key1"), + UNIT_TEST_CHECK_THROW(r.set_attr(root, attr_key("test_key1"), make_pair(false, attr_value("invalid"))), logic_error); - BOOST_CHECK_NOT_THROW(r.check_sane(true), logic_error); + UNIT_TEST_CHECK_NOT_THROW(r.check_sane(true), logic_error); safe_insert(r.get_node(root)->attrs, make_pair(attr_key("test_key2"), make_pair(false, attr_value("invalid")))); - BOOST_CHECK_THROW(r.check_sane(true), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane(true), logic_error); } //////////////////////////////////////////////////////////////////////// @@ -4317,7 +4317,7 @@ UNIT_TEST(roster, die_die_die_merge) // because the dir was created in the old rev, the left side has logically // seen it and killed it, so it needs to be dead in the result. - BOOST_CHECK_THROW( + UNIT_TEST_CHECK_THROW( make_roster_for_merge(left_rid, left_roster, left_markings, left_cs, singleton(left_rid), right_rid, right_roster, right_markings, right_cs, @@ -4325,7 +4325,7 @@ UNIT_TEST(roster, die_die_die_merge) new_rid, new_roster, new_markings, nis), logic_error); - BOOST_CHECK_THROW( + UNIT_TEST_CHECK_THROW( make_roster_for_merge(right_rid, right_roster, right_markings, right_cs, singleton(right_rid), left_rid, left_roster, left_markings, left_cs, @@ -4373,14 +4373,14 @@ UNIT_TEST(roster, same_nid_diff_type) file_roster.check_sane_against(file_markings); cset cs; MM(cs); - BOOST_CHECK_THROW(make_cset(dir_roster, file_roster, cs), logic_error); - BOOST_CHECK_THROW(make_cset(file_roster, dir_roster, cs), logic_error); + UNIT_TEST_CHECK_THROW(make_cset(dir_roster, file_roster, cs), logic_error); + UNIT_TEST_CHECK_THROW(make_cset(file_roster, dir_roster, cs), logic_error); cset left_cs; MM(left_cs); cset right_cs; MM(right_cs); roster_t new_roster; MM(new_roster); marking_map new_markings; MM(new_markings); - BOOST_CHECK_THROW( + UNIT_TEST_CHECK_THROW( make_roster_for_merge(left_rid, dir_roster, dir_markings, left_cs, singleton(left_rid), right_rid, file_roster, file_markings, right_cs, @@ -4388,7 +4388,7 @@ UNIT_TEST(roster, same_nid_diff_type) new_rid, new_roster, new_markings, nis), logic_error); - BOOST_CHECK_THROW( + UNIT_TEST_CHECK_THROW( make_roster_for_merge(left_rid, file_roster, file_markings, left_cs, singleton(left_rid), right_rid, dir_roster, dir_markings, right_cs, @@ -4488,7 +4488,7 @@ UNIT_TEST(roster, write_roster) )); MM(expected); - BOOST_CHECK_NOT_THROW( I(expected == mdat), logic_error); + UNIT_TEST_CHECK_NOT_THROW( I(expected == mdat), logic_error); } { @@ -4546,7 +4546,7 @@ UNIT_TEST(roster, write_roster) )); MM(expected); - BOOST_CHECK_NOT_THROW( I(expected == rdat), logic_error); + UNIT_TEST_CHECK_NOT_THROW( I(expected == rdat), logic_error); } } @@ -4582,7 +4582,7 @@ UNIT_TEST(roster, check_sane_against) r.attach_node(nid, bar); // missing the marking - BOOST_CHECK_THROW(r.check_sane_against(mm), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane_against(mm), logic_error); } { @@ -4606,7 +4606,7 @@ UNIT_TEST(roster, check_sane_against) mark_new_node(rid, r.get_node(nid), mm[nid]); r.detach_node(bar); - BOOST_CHECK_THROW(r.check_sane_against(mm), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane_against(mm), logic_error); } { @@ -4625,7 +4625,7 @@ UNIT_TEST(roster, check_sane_against) mark_new_node(rid, r.get_node(nid), mm[nid]); mm[nid].birth_revision = revision_id(); - BOOST_CHECK_THROW(r.check_sane_against(mm), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane_against(mm), logic_error); } { @@ -4644,7 +4644,7 @@ UNIT_TEST(roster, check_sane_against) mark_new_node(rid, r.get_node(nid), mm[nid]); mm[nid].parent_name.clear(); - BOOST_CHECK_THROW(r.check_sane_against(mm), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane_against(mm), logic_error); } { @@ -4663,7 +4663,7 @@ UNIT_TEST(roster, check_sane_against) mark_new_node(rid, r.get_node(nid), mm[nid]); mm[nid].file_content.clear(); - BOOST_CHECK_THROW(r.check_sane_against(mm), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane_against(mm), logic_error); } { @@ -4682,7 +4682,7 @@ UNIT_TEST(roster, check_sane_against) mark_new_node(rid, r.get_node(nid), mm[nid]); mm[nid].file_content.insert(rid); - BOOST_CHECK_THROW(r.check_sane_against(mm), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane_against(mm), logic_error); } { @@ -4697,7 +4697,7 @@ UNIT_TEST(roster, check_sane_against) mark_new_node(rid, r.get_node(nid), mm[nid]); r.set_attr(root, attr_key("my_key"), attr_value("my_value")); - BOOST_CHECK_THROW(r.check_sane_against(mm), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane_against(mm), logic_error); } { @@ -4712,7 +4712,7 @@ UNIT_TEST(roster, check_sane_against) mark_new_node(rid, r.get_node(nid), mm[nid]); mm[nid].attrs[attr_key("my_key")].clear(); - BOOST_CHECK_THROW(r.check_sane_against(mm), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane_against(mm), logic_error); } { @@ -4727,7 +4727,7 @@ UNIT_TEST(roster, check_sane_against) mark_new_node(rid, r.get_node(nid), mm[nid]); mm[nid].attrs[attr_key("my_second_key")].insert(rid); - BOOST_CHECK_THROW(r.check_sane_against(mm), logic_error); + UNIT_TEST_CHECK_THROW(r.check_sane_against(mm), logic_error); } } ============================================================ --- simplestring_xform.cc 3e052a16b5e80bbc6d44580577879566ff284188 +++ simplestring_xform.cc eb98a7a93a9593dcf13ae3cb9200e4ad9a3b6267 @@ -193,12 +193,12 @@ UNIT_TEST(simplestring_xform, caseconv) UNIT_TEST(simplestring_xform, caseconv) { - BOOST_CHECK(uppercase("hello") == "HELLO"); - BOOST_CHECK(uppercase("heLlO") == "HELLO"); - BOOST_CHECK(lowercase("POODLE DAY") == "poodle day"); - BOOST_CHECK(lowercase("PooDLe DaY") == "poodle day"); - BOOST_CHECK(uppercase("address@hidden&*()") == "address@hidden&*()"); - BOOST_CHECK(lowercase("address@hidden&*()") == "address@hidden&*()"); + UNIT_TEST_CHECK(uppercase("hello") == "HELLO"); + UNIT_TEST_CHECK(uppercase("heLlO") == "HELLO"); + UNIT_TEST_CHECK(lowercase("POODLE DAY") == "poodle day"); + UNIT_TEST_CHECK(lowercase("PooDLe DaY") == "poodle day"); + UNIT_TEST_CHECK(uppercase("address@hidden&*()") == "address@hidden&*()"); + UNIT_TEST_CHECK(lowercase("address@hidden&*()") == "address@hidden&*()"); } UNIT_TEST(simplestring_xform, join_lines) @@ -208,19 +208,19 @@ UNIT_TEST(simplestring_xform, join_lines strs.clear(); join_lines(strs, joined); - BOOST_CHECK(joined == ""); + UNIT_TEST_CHECK(joined == ""); strs.push_back("hi"); join_lines(strs, joined); - BOOST_CHECK(joined == "hi\n"); + UNIT_TEST_CHECK(joined == "hi\n"); strs.push_back("there"); join_lines(strs, joined); - BOOST_CHECK(joined == "hi\nthere\n"); + UNIT_TEST_CHECK(joined == "hi\nthere\n"); strs.push_back("user"); join_lines(strs, joined); - BOOST_CHECK(joined == "hi\nthere\nuser\n"); + UNIT_TEST_CHECK(joined == "hi\nthere\nuser\n"); } UNIT_TEST(simplestring_xform, join_words) @@ -229,43 +229,43 @@ UNIT_TEST(simplestring_xform, join_words set< utf8 > s; v.clear(); - BOOST_CHECK(join_words(v)() == ""); + UNIT_TEST_CHECK(join_words(v)() == ""); v.clear(); v.push_back(utf8("a")); - BOOST_CHECK(join_words(v)() == "a"); - BOOST_CHECK(join_words(v, ", ")() == "a"); + UNIT_TEST_CHECK(join_words(v)() == "a"); + UNIT_TEST_CHECK(join_words(v, ", ")() == "a"); s.clear(); s.insert(utf8("a")); - BOOST_CHECK(join_words(s)() == "a"); - BOOST_CHECK(join_words(s, ", ")() == "a"); + UNIT_TEST_CHECK(join_words(s)() == "a"); + UNIT_TEST_CHECK(join_words(s, ", ")() == "a"); v.clear(); v.push_back(utf8("a")); v.push_back(utf8("b")); - BOOST_CHECK(join_words(v)() == "a b"); - BOOST_CHECK(join_words(v, ", ")() == "a, b"); + UNIT_TEST_CHECK(join_words(v)() == "a b"); + UNIT_TEST_CHECK(join_words(v, ", ")() == "a, b"); s.clear(); s.insert(utf8("b")); s.insert(utf8("a")); - BOOST_CHECK(join_words(s)() == "a b"); - BOOST_CHECK(join_words(s, ", ")() == "a, b"); + UNIT_TEST_CHECK(join_words(s)() == "a b"); + UNIT_TEST_CHECK(join_words(s, ", ")() == "a, b"); v.clear(); v.push_back(utf8("a")); v.push_back(utf8("b")); v.push_back(utf8("c")); - BOOST_CHECK(join_words(v)() == "a b c"); - BOOST_CHECK(join_words(v, ", ")() == "a, b, c"); + UNIT_TEST_CHECK(join_words(v)() == "a b c"); + UNIT_TEST_CHECK(join_words(v, ", ")() == "a, b, c"); s.clear(); s.insert(utf8("b")); s.insert(utf8("a")); s.insert(utf8("c")); - BOOST_CHECK(join_words(s)() == "a b c"); - BOOST_CHECK(join_words(s, ", ")() == "a, b, c"); + UNIT_TEST_CHECK(join_words(s)() == "a b c"); + UNIT_TEST_CHECK(join_words(s, ", ")() == "a, b, c"); } UNIT_TEST(simplestring_xform, split_into_words) @@ -273,32 +273,32 @@ UNIT_TEST(simplestring_xform, split_into vector< utf8 > words; words = split_into_words(utf8("")); - BOOST_CHECK(words.size() == 0); + UNIT_TEST_CHECK(words.size() == 0); words = split_into_words(utf8("foo")); - BOOST_CHECK(words.size() == 1); - BOOST_CHECK(words[0]() == "foo"); + UNIT_TEST_CHECK(words.size() == 1); + UNIT_TEST_CHECK(words[0]() == "foo"); words = split_into_words(utf8("foo bar")); - BOOST_CHECK(words.size() == 2); - BOOST_CHECK(words[0]() == "foo"); - BOOST_CHECK(words[1]() == "bar"); + UNIT_TEST_CHECK(words.size() == 2); + UNIT_TEST_CHECK(words[0]() == "foo"); + UNIT_TEST_CHECK(words[1]() == "bar"); // describe() in commands.cc assumes this behavior. If it ever changes, // remember to modify that function accordingly! words = split_into_words(utf8("foo bar")); - BOOST_CHECK(words.size() == 3); - BOOST_CHECK(words[0]() == "foo"); - BOOST_CHECK(words[1]() == ""); - BOOST_CHECK(words[2]() == "bar"); + UNIT_TEST_CHECK(words.size() == 3); + UNIT_TEST_CHECK(words[0]() == "foo"); + UNIT_TEST_CHECK(words[1]() == ""); + UNIT_TEST_CHECK(words[2]() == "bar"); } UNIT_TEST(simplestring_xform, strip_ws) { - BOOST_CHECK(trim_ws("\n leading space") == "leading space"); - BOOST_CHECK(trim_ws("trailing space \n") == "trailing space"); - BOOST_CHECK(trim_ws("\t\n both \r \n\r\n") == "both"); - BOOST_CHECK(remove_ws(" I like going\tfor walks\n ") + UNIT_TEST_CHECK(trim_ws("\n leading space") == "leading space"); + UNIT_TEST_CHECK(trim_ws("trailing space \n") == "trailing space"); + UNIT_TEST_CHECK(trim_ws("\t\n both \r \n\r\n") == "both"); + UNIT_TEST_CHECK(remove_ws(" I like going\tfor walks\n ") == "Ilikegoingforwalks"); } ============================================================ --- string_queue.cc efa027721a9185785b0e59e74b09e5e6c9ea9054 +++ string_queue.cc 3c8ba74dc7770c6fd3e6f8934190d097338a238f @@ -14,57 +14,57 @@ UNIT_TEST(string_queue, string_queue) { string_queue sq1; - BOOST_CHECKPOINT( "append" ); + UNIT_TEST_CHECKPOINT( "append" ); sq1.append("123"); sq1.append("45z", 2); // 'z' shall be ignored sq1.append('6'); - BOOST_CHECK( sq1.size() == 6 ); + UNIT_TEST_CHECK( sq1.size() == 6 ); - BOOST_CHECKPOINT( "retrieve" ); + UNIT_TEST_CHECKPOINT( "retrieve" ); - BOOST_CHECK( sq1.substr(0, 6) == "123456" ); - BOOST_CHECK( sq1.substr(3, 2) == "45" ); + UNIT_TEST_CHECK( sq1.substr(0, 6) == "123456" ); + UNIT_TEST_CHECK( sq1.substr(3, 2) == "45" ); - BOOST_CHECK( sq1[5] == '6' ); - BOOST_CHECK( sq1[0] == '1' ); + UNIT_TEST_CHECK( sq1[5] == '6' ); + UNIT_TEST_CHECK( sq1[0] == '1' ); - BOOST_CHECK( *(sq1.front_pointer(6)) == '1'); + UNIT_TEST_CHECK( *(sq1.front_pointer(6)) == '1'); - BOOST_CHECK( sq1.size() == 6); + UNIT_TEST_CHECK( sq1.size() == 6); - BOOST_CHECKPOINT( "failures" ); + UNIT_TEST_CHECKPOINT( "failures" ); // check a few things will fail - BOOST_CHECK_THROW( sq1.substr(3, 4), logic_error ); - BOOST_CHECK_THROW( sq1.front_pointer(7), logic_error ); + UNIT_TEST_CHECK_THROW( sq1.substr(3, 4), logic_error ); + UNIT_TEST_CHECK_THROW( sq1.front_pointer(7), logic_error ); // modification - BOOST_CHECKPOINT( "modification" ); + UNIT_TEST_CHECKPOINT( "modification" ); sq1[5] = 'r'; - BOOST_CHECK_THROW( sq1[6], logic_error ); + UNIT_TEST_CHECK_THROW( sq1[6], logic_error ); - BOOST_CHECK( sq1[5] == 'r' ); - BOOST_CHECK( sq1.substr(3, 3) == "45r" ); + UNIT_TEST_CHECK( sq1[5] == 'r' ); + UNIT_TEST_CHECK( sq1.substr(3, 3) == "45r" ); // empty it out - BOOST_CHECKPOINT( "emptying" ); + UNIT_TEST_CHECKPOINT( "emptying" ); - BOOST_CHECK_THROW( sq1.pop_front( 7 ), logic_error ); + UNIT_TEST_CHECK_THROW( sq1.pop_front( 7 ), logic_error ); sq1.pop_front(1); - BOOST_CHECK( sq1.size() == 5 ); - BOOST_CHECK(sq1[0] == '2'); + UNIT_TEST_CHECK( sq1.size() == 5 ); + UNIT_TEST_CHECK(sq1[0] == '2'); - BOOST_CHECK(sq1[4] == 'r'); - BOOST_CHECK_THROW( sq1[5], logic_error ); - BOOST_CHECK_THROW( sq1.pop_front( 6 ), logic_error ); + UNIT_TEST_CHECK(sq1[4] == 'r'); + UNIT_TEST_CHECK_THROW( sq1[5], logic_error ); + UNIT_TEST_CHECK_THROW( sq1.pop_front( 6 ), logic_error ); sq1.pop_front(5); - BOOST_CHECK_THROW( sq1.pop_front( 1 ), logic_error ); + UNIT_TEST_CHECK_THROW( sq1.pop_front( 1 ), logic_error ); // it's empty again - BOOST_CHECK( sq1.size() == 0 ); + UNIT_TEST_CHECK( sq1.size() == 0 ); } #endif // BUILD_UNIT_TESTS ============================================================ --- transforms.cc 11205cfd44465baf2003bea2cb1643c0af6555ad +++ transforms.cc a6e23fbd561ca7ed18e71908e3829e29b0c94c5b @@ -278,9 +278,9 @@ UNIT_TEST(transform, enc) encode_gzip(d1, gzd1); encode_base64(gzd1, bgzd); decode_base64(bgzd, gzd2); - BOOST_CHECK(gzd2 == gzd1); + UNIT_TEST_CHECK(gzd2 == gzd1); decode_gzip(gzd2, d2); - BOOST_CHECK(d2 == d1); + UNIT_TEST_CHECK(d2 == d1); } UNIT_TEST(transform, rdiff) @@ -292,7 +292,7 @@ UNIT_TEST(transform, rdiff) data dat3; patch(dat1, del, dat3); - BOOST_CHECK(dat3 == dat2); + UNIT_TEST_CHECK(dat3 == dat2); } UNIT_TEST(transform, calculate_ident) @@ -301,7 +301,7 @@ UNIT_TEST(transform, calculate_ident) hexenc output; string ident("86e03bdb3870e2a207dfd0dcbfd4c4f2e3bc97bd"); calculate_ident(input, output); - BOOST_CHECK(output() == ident); + UNIT_TEST_CHECK(output() == ident); } UNIT_TEST(transform, corruption_check) @@ -319,7 +319,7 @@ UNIT_TEST(transform, corruption_check) gzip gzbad(gzs); data output; - BOOST_CHECK_THROW(decode_gzip(gzbad, output), informative_failure); + UNIT_TEST_CHECK_THROW(decode_gzip(gzbad, output), informative_failure); } #endif // BUILD_UNIT_TESTS ============================================================ --- unit_tests.cc b7e283d0d3ca3a50906641adcbf2ba656050030f +++ unit_tests.cc cf96c37f99db8ef8d69df5ab1a77e8789a126ac9 @@ -16,12 +16,7 @@ #include #include -#include #include -#include -#if BOOST_VERSION >= 103300 -#include -#endif #include "botan/botan.h" #include "option.hh" @@ -29,7 +24,7 @@ #include "sanity.hh" #include "ui.hh" -using std::multimap; +using std::map; using std::pair; using std::make_pair; using std::vector; @@ -39,40 +34,131 @@ using std::atexit; using std::clog; using std::exit; using std::atexit; -using boost::unit_test::test_suite; -typedef boost::unit_test::test_case boost_unit_test_case; -// This must be a pointer. It is used by the constructor below, which is -// used to construct file-scope objects in different files; if it were the -// actual object there would be no way to guarantee that this gets -// constructed first. Instead, we initialize it ourselves the first time we -// use it. -typedef multimap unit_test_list_t; +typedef unit_test::unit_test_case test_t; +typedef map test_list_t; +typedef map group_list_t; -static unit_test_list_t * unit_tests; +// This is used by other global constructors, so initialize on demand. +group_list_t & unit_tests() +{ + static group_list_t tests; + return tests; +} unit_test::unit_test_case::unit_test_case(char const * group, - char const * test, + char const * name, void (*func)()) + : group(group), name(name), func(func) { - if (unit_tests == NULL) - unit_tests = new unit_test_list_t; + unit_tests()[group][name] = *this; +} - boost_unit_test_case * tcase = BOOST_TEST_CASE(func); -#if BOOST_VERSION >= 103300 - tcase->p_name.set(string(test)); -#endif - unit_tests->insert(make_pair(string(group), tcase)); +unit_test::unit_test_case::unit_test_case() +{} + +// Testsuite state. +bool any_test_failed = false; +int number_of_failed_tests = 0; +int number_of_succeeded_tests = 0; + +// Test state. +bool this_test_failed; +string last_checkpoint; + +struct require_failed {}; + +void note_checkpoint(char const * file, int line, + char const * kind, string const & msg) +{ + last_checkpoint = (FL("%s:%s> %s: %s") + % file % line % kind % msg).str(); } -// This appears to be the sanest way to get progress notifications on a -// per-test-group level. -static void notifier(string const & group) +void log_checkpoint() { - cerr << group << "...\n"; + if (last_checkpoint == "") + return; + cerr<<"Last checkpoint: "< %s: %s\n") % file % line % kind % msg; + log_checkpoint(); +} + +void unit_test::do_check(bool checkval, char const * file, + int line, char const * message) +{ + if (!checkval) + { + this_test_failed = true; + log_fail(file, line, "CHECK FAILED", message); + } + else + note_checkpoint(file, line, "CHECK OK", message); +} + +void unit_test::do_require(bool checkval, char const * file, + int line, char const * message) +{ + if (!checkval) + { + this_test_failed = true; + log_fail(file, line, "REQUIRE FAILED", message); + } + else + note_checkpoint(file, line, "REQUIRE OK", message); +} + +void unit_test::do_checkpoint(char const * file, int line, + string const & message) +{ + note_checkpoint(file, line, "CHECKPOINT", message); +} + +void run_test(test_t test) +{ + this_test_failed = false; + last_checkpoint = ""; + + cerr<<"----------------------------------------\n"; + cerr<<(FL("Beginning test %s:%s\n") % test.group % test.name); + + try + { + test.func(); + } + catch(require_failed &) + { + this_test_failed = true; + } + catch(...) + { + cerr< UNCAUGHT EXCEPTION\n"; + this_test_failed = true; + } + + if (this_test_failed) + { + ++number_of_failed_tests; + cerr<<(FL("Test %s:%s failed.\n") % test.group % test.name); + log_checkpoint(); + } + else + { + ++number_of_succeeded_tests; + cerr<<(FL("Test %s:%s succeeded.\n") % test.group % test.name); + } + + if (this_test_failed) + any_test_failed = true; +} + + // A teebuf implements the basic_streambuf interface and forwards all // operations to two 'targets'. This is used to get progress messages sent // to both the log file and the terminal. Note that it cannot be used for @@ -150,7 +236,7 @@ namespace { typedef basic_teebuf teebuf; } -test_suite * init_unit_test_suite(int argc, char * argv[]) +int main(int argc, char * argv[]) { bool help(false); bool list_groups(false); @@ -194,102 +280,32 @@ test_suite * init_unit_test_suite(int ar if (list_groups) { - string last; - for (unit_test_list_t::const_iterator i = unit_tests->begin(); - i != unit_tests->end(); - i++) - if (last != (*i).first) - { - cout << (*i).first << '\n'; - last = (*i).first; - } - exit(0); + for (group_list_t::const_iterator i = unit_tests().begin(); + i != unit_tests().end(); i++) + { + if (i->first != "") + cout << i->first << '\n'; + } + return 0; } if (list_tests) { - for (unit_test_list_t::const_iterator i = unit_tests->begin(); - i != unit_tests->end(); - i++) - cout << (*i).first << ':' << (*i).second->p_name.get() << '\n'; - exit(0); - } - - // If we get here, we are really running the test suite. - test_suite * suite = BOOST_TEST_SUITE("monotone unit tests"); - - if (tests.size() == 0) // run all tests - { - string last; - for (unit_test_list_t::const_iterator i = unit_tests->begin(); - i != unit_tests->end(); - i++) + for (group_list_t::const_iterator i = unit_tests().begin(); + i != unit_tests().end(); i++) { - if (last != (*i).first) + if (i->first == "") + continue; + for (test_list_t::const_iterator j = i->second.begin(); + j != i->second.end(); ++j) { - suite->add(BOOST_PARAM_TEST_CASE(notifier, - &((*i).first), - &((*i).first)+1)); - last = (*i).first; + cout << i->first << ":" << j->first << "\n"; } - suite->add((*i).second); } + return 0; } - else - { - bool unrecognized = false; - for(vector::const_iterator i = tests.begin(); - i != tests.end(); - i++) - { - string group, test; - string::size_type sep = (*i).find(":"); - if (sep >= (*i).length()) // it's a group name - group = *i; - else - { - group = (*i).substr(0, sep); - test = (*i).substr(sep+1, string::npos); - } - - pair - range = unit_tests->equal_range(group); - - if (range.first == range.second) - { - unrecognized = true; - cerr << argv[0] << ": unrecognized test group: " - << group << '\n'; - continue; - } - - suite->add(BOOST_PARAM_TEST_CASE(notifier, - &(*i), &(*i)+1)); - - bool found = false; - for (unit_test_list_t::const_iterator j = range.first; - j != range.second; - j++) - if (test == "" || test == (*j).second->p_name.get()) - { - suite->add((*j).second); - found = true; - } - if (!found) - { - unrecognized = true; - cerr << argv[0] << ": unrecognized test: " - << group << ':' << test << '\n'; - } - } - - if (unrecognized) - exit(1); - } - // set up some global state before running the tests ui.initialize(); ui.prog_name = argv[0]; @@ -339,7 +355,93 @@ test_suite * init_unit_test_suite(int ar } global_sanity.set_debug(); - return suite; + + + if (tests.size() == 0) // run all tests + { + for (group_list_t::const_iterator i = unit_tests().begin(); + i != unit_tests().end(); i++) + { + if (i->first == "") + continue; + for (test_list_t::const_iterator j = i->second.begin(); + j != i->second.end(); ++j) + { + run_test(j->second); + } + } + } + else + { + bool unrecognized = false; + + vector to_run; + + for(vector::const_iterator i = tests.begin(); + i != tests.end(); + i++) + { + string group, test; + string::size_type sep = (*i).find(":"); + + if (sep >= (*i).length()) // it's a group name + group = *i; + else + { + group = (*i).substr(0, sep); + test = (*i).substr(sep+1, string::npos); + } + + group_list_t::const_iterator g = unit_tests().find(group); + + if (g == unit_tests().end()) + { + unrecognized = true; + cerr << argv[0] << ": unrecognized test group: " + << group << '\n'; + continue; + } + + if (test == "") // entire group + { + for (test_list_t::const_iterator t = g->second.begin(); + t != g->second.end(); ++t) + { + to_run.push_back(t->second); + } + } + else + { + test_list_t::const_iterator t = g->second.find(test); + if (t == g->second.end()) + { + unrecognized = true; + cerr << argv[0] << ": unrecognized test: " + << group << '\n'; + continue; + } + to_run.push_back(t->second); + } + } + + if (unrecognized) + { + return 1; + } + else + { + for (vector::const_iterator i = to_run.begin(); + i != to_run.end(); ++i) + { + run_test(*i); + } + } + } + + cerr< +#include -// strangely this was left out. perhaps it'll arrive later? -#ifndef BOOST_CHECK_NOT_THROW -#define BOOST_CHECK_NOT_THROW(statement, exception) \ +// Log a success/failure message, and set the test state to 'fail' if needed +#define UNIT_TEST_CHECK(expression) \ + unit_test::do_check(expression, __FILE__, __LINE__, #expression) + +// Like UNIT_TEST_CHECK, but abort the test immediately on failure +#define UNIT_TEST_REQUIRE(expression) \ + unit_test::do_require(expression, __FILE__, __LINE__, #expression) + +#define UNIT_TEST_CHECK_THROW(statement, exception) \ do \ { \ + bool fnord_unit_test_checkval = false; \ try \ { \ statement; \ - BOOST_CHECK_MESSAGE(true, "exception "#exception" did not occur"); \ } \ catch(exception const &) \ { \ - BOOST_ERROR("exception "#exception" occurred"); \ + fnord_unit_test_checkval = true; \ } \ + unit_test::do_check(fnord_unit_test_checkval, __FILE__, __LINE__, \ + #statement " throws " #exception); \ } while (0) -#endif -// Declarative mechanism for specifying unit tests, similar to -// auto_unit_test in boost, but more suited to our needs. +#define UNIT_TEST_CHECK_NOT_THROW(statement, exception) \ + do \ + { \ + bool fnord_unit_test_checkval = true; \ + try \ + { \ + statement; \ + } \ + catch(exception const &) \ + { \ + fnord_unit_test_checkval = false; \ + } \ + unit_test::do_check(fnord_unit_test_checkval, __FILE__, __LINE__, \ + #statement " does not throw " #exception); \ + } while (0) + +#define UNIT_TEST_CHECKPOINT(message) \ + unit_test::do_checkpoint(__FILE__, __LINE__, message); + + namespace unit_test { + void do_check(bool checkval, char const * file, + int line, char const * message); + + void do_require(bool checkval, char const * file, + int line, char const * message); + + void do_checkpoint(char const * file, int line, std::string const & message); + + // Declarative mechanism for specifying unit tests, similar to + // auto_unit_test in boost, but more suited to our needs. struct unit_test_case { + char const *group; + char const *name; + void (*func)(); unit_test_case(char const * group, - char const *test, + char const * name, void (*func)()); - + unit_test_case(); }; } ============================================================ --- uri.cc 72edc51b298f51cac2c9b431ac72e5987f6d53f9 +++ uri.cc 3fd42bc9b1453ba09c349a8b9561831e7d37d6c6 @@ -161,14 +161,14 @@ test_one_uri(string scheme, L(FL("testing parse of URI '%s'") % built); uri u; - BOOST_CHECK(parse_uri(built, u)); - BOOST_CHECK(u.scheme == scheme); - BOOST_CHECK(u.user == user); - BOOST_CHECK(u.host == host); - BOOST_CHECK(u.port == port); - BOOST_CHECK(u.path == path); - BOOST_CHECK(u.query == query); - BOOST_CHECK(u.fragment == fragment); + UNIT_TEST_CHECK(parse_uri(built, u)); + UNIT_TEST_CHECK(u.scheme == scheme); + UNIT_TEST_CHECK(u.user == user); + UNIT_TEST_CHECK(u.host == host); + UNIT_TEST_CHECK(u.port == port); + UNIT_TEST_CHECK(u.path == path); + UNIT_TEST_CHECK(u.query == query); + UNIT_TEST_CHECK(u.fragment == fragment); } UNIT_TEST(uri, uri) ============================================================ --- vocab.cc 842d7558aa658249160db34543481792f4a7a081 +++ vocab.cc 9e7e99b5b2e0088d4b2e2f41b0cb0682fb2024c0 @@ -237,53 +237,53 @@ UNIT_TEST(vocab, verify_hexenc_id) UNIT_TEST(vocab, verify_hexenc_id) { // -------- magic empty string and default constructor are okay: - BOOST_CHECK(hexenc("")() == ""); + UNIT_TEST_CHECK(hexenc("")() == ""); hexenc my_default_id; - BOOST_CHECK(my_default_id() == ""); + UNIT_TEST_CHECK(my_default_id() == ""); // -------- wrong length: - BOOST_CHECK_THROW(hexenc("a"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("a"), informative_failure); // 39 letters - BOOST_CHECK_THROW(hexenc("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + UNIT_TEST_CHECK_THROW(hexenc("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), informative_failure); // 41 letters - BOOST_CHECK_THROW(hexenc("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + UNIT_TEST_CHECK_THROW(hexenc("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), informative_failure); // but 40 is okay - BOOST_CHECK(hexenc("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")() + UNIT_TEST_CHECK(hexenc("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")() == "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); // -------- bad characters: - BOOST_CHECK_THROW(hexenc("g000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("h000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("G000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("H000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("*000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("`000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("z000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("Z000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("g000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("h000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("G000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("H000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("*000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("`000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("z000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("Z000000000000000000000000000000000000000"), informative_failure); // different positions: - BOOST_CHECK_THROW(hexenc("g000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("0g00000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("00g0000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("000g000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("0000g00000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("000000000000000000000g000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("0000000000000000000000g00000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("000000000000000000000000000000g000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("000000000000000000000000000000000000g000"), informative_failure); - BOOST_CHECK_THROW(hexenc("0000000000000000000000000000000000000g00"), informative_failure); - BOOST_CHECK_THROW(hexenc("00000000000000000000000000000000000000g0"), informative_failure); - BOOST_CHECK_THROW(hexenc("000000000000000000000000000000000000000g"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("g000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("0g00000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("00g0000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("000g000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("0000g00000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("000000000000000000000g000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("0000000000000000000000g00000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("000000000000000000000000000000g000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("000000000000000000000000000000000000g000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("0000000000000000000000000000000000000g00"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("00000000000000000000000000000000000000g0"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("000000000000000000000000000000000000000g"), informative_failure); // uppercase hex is bad too! - BOOST_CHECK_THROW(hexenc("A000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("B000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("C000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("D000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("E000000000000000000000000000000000000000"), informative_failure); - BOOST_CHECK_THROW(hexenc("F000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("A000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("B000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("C000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("D000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("E000000000000000000000000000000000000000"), informative_failure); + UNIT_TEST_CHECK_THROW(hexenc("F000000000000000000000000000000000000000"), informative_failure); // but lowercase and digits are all fine - BOOST_CHECK(hexenc("0123456789abcdef0123456789abcdef01234567")() + UNIT_TEST_CHECK(hexenc("0123456789abcdef0123456789abcdef01234567")() == "0123456789abcdef0123456789abcdef01234567"); } ============================================================ --- xdelta.cc 3f7317d83d21a7eb42f14d1fbac55e795b28dbe6 +++ xdelta.cc 62598b3546340ead92754e868ac579292550a32a @@ -824,17 +824,17 @@ spin(string a, string b) string ab, ba; compute_delta(a, b, ab); compute_delta(b, a, ba); - BOOST_CHECK(a == apply_via_normal(b, ba)); - BOOST_CHECK(a == apply_via_piecewise(b, ba)); - BOOST_CHECK(b == apply_via_normal(a, ab)); - BOOST_CHECK(b == apply_via_piecewise(a, ab)); + UNIT_TEST_CHECK(a == apply_via_normal(b, ba)); + UNIT_TEST_CHECK(a == apply_via_piecewise(b, ba)); + UNIT_TEST_CHECK(b == apply_via_normal(a, ab)); + UNIT_TEST_CHECK(b == apply_via_piecewise(a, ab)); string ab_inverted, ba_inverted; invert_xdelta(a, ab, ab_inverted); invert_xdelta(b, ba, ba_inverted); - BOOST_CHECK(a == apply_via_normal(b, ab_inverted)); - BOOST_CHECK(a == apply_via_piecewise(b, ab_inverted)); - BOOST_CHECK(b == apply_via_normal(a, ba_inverted)); - BOOST_CHECK(b == apply_via_piecewise(a, ba_inverted)); + UNIT_TEST_CHECK(a == apply_via_normal(b, ab_inverted)); + UNIT_TEST_CHECK(a == apply_via_piecewise(b, ab_inverted)); + UNIT_TEST_CHECK(b == apply_via_normal(a, ba_inverted)); + UNIT_TEST_CHECK(b == apply_via_piecewise(a, ba_inverted)); } UNIT_TEST(xdelta, simple_cases) @@ -957,7 +957,7 @@ UNIT_TEST(xdelta, random_piecewise_delta for (int j = 0; j < 5; ++j) { appl->finish(got); - BOOST_CHECK(got == prev); + UNIT_TEST_CHECK(got == prev); next = prev; xdelta_randomly_change(next); xdelta_randomly_insert(next); @@ -969,7 +969,7 @@ UNIT_TEST(xdelta, random_piecewise_delta prev = next; } appl->finish(got); - BOOST_CHECK(got == prev); + UNIT_TEST_CHECK(got == prev); } } @@ -1003,7 +1003,7 @@ UNIT_TEST(xdelta, rolling_sanity_check) } skip.replace_with(reinterpret_cast(testbuf + new_lo), new_hi - new_lo); - BOOST_CHECK(skip.sum() == incremental.sum()); + UNIT_TEST_CHECK(skip.sum() == incremental.sum()); } L(FL("rolling sanity check passed")); }