#include "tapelib/filetape.h" #include #include #include #include #include #include using std::setfill; using std::setw; using std::string; using std::to_string; using namespace tape; /** * Generate big input data sets for external sort testing. * Takes 2 positional arguments - first one is the ouput file name, * secon one is the amount of random cells that will be generated. * Each cell value is in range [0; RAND_MAX] */ int main(int argc, char *argv[]) { if (argc < 3) { std::cerr << "Not enough arguments" << std::endl; return -1; } string out_name = argv[1]; // NOLINT size_t cells = std::stoi(argv[2]); // NOLINT std::ofstream out(out_name); if (!out.is_open()) { std::cerr << "Failed to open file" << std::endl; return -1; } srand(time(nullptr)); out << setfill('0') << setw(tape::FT_CELL_SIZE) << to_string(rand()); for (size_t i = 1; i < cells; i++) { out << FT_DELIMETER << setfill('0') << setw(tape::FT_CELL_SIZE) << to_string(rand()); } return 0; }