6 #ifndef TURI_GENERAL_TESTING_UTILS_H_ 7 #define TURI_GENERAL_TESTING_UTILS_H_ 9 #include <core/parallel/pthread_tools.hpp> 10 #include <core/util/cityhash_tc.hpp> 11 #include <core/util/try_finally.hpp> 12 #include <core/random/random.hpp> 13 #include <core/storage/serialization/serialization_includes.hpp> 18 #include <core/parallel/mutex.hpp> 19 #include <sys/types.h> 21 #include <boost/filesystem.hpp> 42 template <
typename T,
typename U>
49 std::string arc_name = dir +
"/test_archive";
51 uint64_t random_number =
hash64(random::fast_uniform<size_t>(0,
size_t(-1)));
59 oarc << src << random_number;
61 archive_write.
close();
77 ASSERT_EQ(test_number, random_number);
80 #define save_and_load_object(dest, src) \ 82 _save_and_load_object( \ 83 dest, src, _get_unique_directory(__FILE__, __LINE__)); \ void open_directory_for_write(std::string directory, bool fail_on_existing=false)
void open_directory_for_read(std::string directory)
The serialization input archive object which, provided with a reference to an istream, will read from the istream, providing deserialization capabilities.
bool create_directory(const std::string &path)
void _add_directory_to_deleter(const std::string &name)
static uint64_t hash64(const char *s, size_t len)
void _save_and_load_object(T &dest, const U &src, std::string dir)
std::string _get_unique_directory(const std::string &file, size_t line)
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.