43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
|
#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) {
|
||
|
}
|
||
|
}
|