Compare commits

...

2 commits

Author SHA1 Message Date
e494762c3a small improvement 2018-08-10 14:24:57 +02:00
d0311e4333 make test data 2018-08-10 14:24:27 +02:00
3 changed files with 46 additions and 3 deletions

View file

@ -56,9 +56,9 @@ class Marketplace
friend class ExcelReader;
private:
SellersVec sellers_;
SalesVec sales_;
BasketVec basket_;
SellersVec sellers_{500};
SalesVec sales_{50000};
BasketVec basket_{50};
};
double marketFee(int sumInCent, int percent, int maxFeeInCent);

View 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
View 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) {
}
}