make test data
This commit is contained in:
parent
5b02f7dabe
commit
d0311e4333
2 changed files with 43 additions and 0 deletions
1
test/compile_make_sales.sh
Normal file
1
test/compile_make_sales.sh
Normal file
|
@ -0,0 +1 @@
|
|||
g++ -I ../src/core make_sales.cpp -L /home/brodbemn/Entwicklung/kima2/build/lib -l core -L /usr/lib -l sqlite3 -l stdc++fs -l boost_date_time -o make_sales
|
42
test/make_sales.cpp
Normal file
42
test/make_sales.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#include "../src/core/database.h"
|
||||
#include "../src/core/seller.h"
|
||||
#include "../src/core/sale.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::vector<std::unique_ptr<Seller>> sellers;
|
||||
std::vector<std::unique_ptr<Sale>> sales;
|
||||
|
||||
Database db("test.db");
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < 300; ++i) {
|
||||
auto seller = std::make_unique<Seller>();
|
||||
seller->createUuid();
|
||||
seller->setSellerNo(i + 1);
|
||||
for (int j = 0; j < 100; ++j) {
|
||||
++count;
|
||||
auto article = std::make_unique<Article>();
|
||||
article->createUuid();
|
||||
article->setSourceNo(3);
|
||||
article->setArticleNo(count);
|
||||
article->setPrice(500);
|
||||
auto sale = std::make_unique<Sale>();
|
||||
sale->createUuid();
|
||||
sale->setSourceNo(3);
|
||||
sale->addArticle(article.get());
|
||||
sales.push_back(std::move(sale));
|
||||
seller->addArticle(std::move(article));
|
||||
}
|
||||
sellers.push_back(std::move(seller));
|
||||
}
|
||||
|
||||
db.storeSellers(sellers);
|
||||
db.storeSales(sales);
|
||||
|
||||
for (int i = 0; i < 30000; ++i) {
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue