memgraph/tests/manual/console_test.cpp
Mislav Bradac 6068a95a0e Move dbms to database
Summary:
There was only two files in dbms directory so I moved them to database
directory.

Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D540
2017-07-12 12:44:11 +02:00

47 lines
1.4 KiB
C++

#include <iostream>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include "database/dbms.hpp"
#include "query/console.hpp"
#include "query/interpreter.hpp"
#include "utils/random_graph_generator.hpp"
void random_generate(Dbms &dbms, uint node_count, int edge_factor = 5) {
auto dba = dbms.active();
utils::RandomGraphGenerator generator(*dba);
auto edge_count = node_count * edge_factor;
generator.AddVertices(node_count, {"Person"});
generator.AddEdges(edge_count, "Friend");
generator.SetVertexProperty<int>(node_count, "age",
utils::RandomIntGenerator(3, 60));
generator.SetVertexProperty<int>(node_count, "height",
utils::RandomIntGenerator(120, 200));
generator.Commit();
}
int main(int argc, char *argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
// parse the first cmd line argument as the count of nodes to randomly create
uint node_count = 0;
if (argc > 1) {
node_count = (uint)std::stoul(argv[1]);
permanent_assert(node_count < 10000000,
"More then 10M nodes requested, that's too much");
}
// TODO switch to GFlags, once finally available
if (argc > 2) google::InitGoogleLogging(argv[0]);
Dbms dbms;
std::cout << "Generating graph..." << std::endl;
// fill_db(dbms);
random_generate(dbms, node_count);
query::Repl(dbms);
return 0;
}