verification
This commit is contained in:
parent
eddfd42284
commit
635ad1a225
4 changed files with 38 additions and 4 deletions
27
main.cpp
27
main.cpp
|
|
@ -18,6 +18,28 @@ void generate_file(int N, const std::string& filename)
|
|||
}
|
||||
}
|
||||
|
||||
void read_and_evaluate(std::string filename, int n)
|
||||
{
|
||||
Buffer main_buffer(n);
|
||||
auto buff = main_buffer.divide(1)[0];
|
||||
|
||||
std::ifstream in_stream(filename);
|
||||
Reader input_reader(in_stream);
|
||||
|
||||
while (true) {
|
||||
size_t records_read = read_chunk(input_reader, buff);
|
||||
|
||||
if (records_read == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < records_read; ++i) {
|
||||
const Record& rec = buff[i];
|
||||
std::cout << "[Evaluate i = " << i << ": " << rec.evaluate() << "] " << rec << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try {
|
||||
|
|
@ -28,6 +50,11 @@ int main(int argc, char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (opts.evaluate_file) {
|
||||
read_and_evaluate(opts.input_file, opts.N);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sort_file(opts);
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue