# # # patch "Makefile.am" # from [2a42de1455a8d6a5b635bebab2f0965da83a95b4] # to [159415343db9305b3b694eb38be0cf48345463a8] # # patch "base.hh" # from [77e8fea2271e17bb57bb1c960888da3c65ae2a7c] # to [47fa9166411f1ed96a75ab6753a6c71b88d782f3] # # patch "roster.cc" # from [651004a7654b8207825616a9e3ee57ab6161d7cc] # to [9587de0d8b3a9387d29aa8d773d0789cda48e72c] # # patch "roster.hh" # from [42fddc750f7fd625fb0aa420e2d108b4c7870371] # to [7d804006ba9ae9662c967f905d722ddf891030af] # # patch "sanity.cc" # from [e17d2f198f5d84dea98f03bd5a4918a8e386870d] # to [a8836cf95d078e7230265448bc755d278c1e1ec6] # # patch "unit-tests/roster.cc" # from [385e1b7608de406d4ea0516ddc3bbc432686cdf1] # to [e92468f236c41566fc46209badc8e64d09868308] # ============================================================ --- Makefile.am 2a42de1455a8d6a5b635bebab2f0965da83a95b4 +++ Makefile.am 159415343db9305b3b694eb38be0cf48345463a8 @@ -211,7 +211,8 @@ tester_SOURCES = tester.cc transforms.cc $(UNIT_TESTEES) $(UNIT_TEST_SUPPORT) tester_SOURCES = tester.cc transforms.cc gzip.cc \ - $(SANITY_CORE_SOURCES) $(LUAEXT_SOURCES) pcrewrap.cc + $(SANITY_CORE_SOURCES) $(LUAEXT_SOURCES) pcrewrap.cc \ + specialized_lexical_cast.cc nodist_tester_SOURCES = testlib.cc txt2c_SOURCES = txt2c.cc ============================================================ --- base.hh 77e8fea2271e17bb57bb1c960888da3c65ae2a7c +++ base.hh 47fa9166411f1ed96a75ab6753a6c71b88d782f3 @@ -27,6 +27,9 @@ #include #include // it would be nice if there were a +// s32, u64, etc +#include "numeric_vocab.hh" + // this template must be specialized for each type you want to dump // (or apply MM() to -- see sanity.hh). there are a few stock dumpers // in appropriate places. @@ -45,6 +48,10 @@ template <> void dump(bool const & obj, template <> void dump(std::string const & obj, std::string & out); template <> void dump(char const * const & obj, std::string & out); template <> void dump(bool const & obj, std::string & out); +template <> void dump(s32 const & obj, std::string & out); +template <> void dump(u32 const & obj, std::string & out); +template <> void dump(s64 const & obj, std::string & out); +template <> void dump(u64 const & obj, std::string & out); // NORETURN(void function()); declares a function that will never return // in the normal fashion. a function that invariably throws an exception ============================================================ --- roster.cc 651004a7654b8207825616a9e3ee57ab6161d7cc +++ roster.cc 9587de0d8b3a9387d29aa8d773d0789cda48e72c @@ -62,12 +62,6 @@ template <> void } template <> void -dump(node_id const & val, string & out) -{ - out = lexical_cast(val); -} - -template <> void dump(attr_map_t const & val, string & out) { ostringstream oss; ============================================================ --- roster.hh 42fddc750f7fd625fb0aa420e2d108b4c7870371 +++ roster.hh 7d804006ba9ae9662c967f905d722ddf891030af @@ -32,7 +32,6 @@ null_node(node_id n) return n == the_null_node; } -template <> void dump(node_id const & val, std::string & out); template <> void dump(attr_map_t const & val, std::string & out); enum roster_node_type { node_type_none, node_type_file, node_type_dir }; ============================================================ --- sanity.cc e17d2f198f5d84dea98f03bd5a4918a8e386870d +++ sanity.cc a8836cf95d078e7230265448bc755d278c1e1ec6 @@ -35,6 +35,7 @@ using boost::format; using std::vector; using boost::format; +using boost::lexical_cast; // set by sanity::initialize std::string const * prog_name_ptr; @@ -484,6 +485,26 @@ dump(bool const & obj, string & out) { out = (obj ? "true" : "false"); } +template <> void +dump(s32 const & val, string & out) +{ + out = lexical_cast(val); +} +template <> void +dump(u32 const & val, string & out) +{ + out = lexical_cast(val); +} +template <> void +dump(s64 const & val, string & out) +{ + out = lexical_cast(val); +} +template <> void +dump(u64 const & val, string & out) +{ + out = lexical_cast(val); +} void sanity::print_var(std::string const & value, char const * var, ============================================================ --- unit-tests/roster.cc 385e1b7608de406d4ea0516ddc3bbc432686cdf1 +++ unit-tests/roster.cc e92468f236c41566fc46209badc8e64d09868308 @@ -484,12 +484,6 @@ testing_node_id_source::next() return n; } -template <> void -dump(int const & i, string & out) -{ - out = lexical_cast(i) + "\n"; -} - UNIT_TEST(random_actions) { randomizer rng;