diff --git a/README.md b/README.md
index b37f3fc..54241e5 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1 @@
-
-
-[Dokumentation](https://files.joethei.space/documentation/Studium/C_CPP/)
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/10_PITF/Testat/Bank.cpp b/src/10_PITF/Testat/Bank.cpp
index 9206953..c204b1f 100644
--- a/src/10_PITF/Testat/Bank.cpp
+++ b/src/10_PITF/Testat/Bank.cpp
@@ -1,5 +1,6 @@
#include
#include
+#include
#include "Bank.h"
@@ -11,6 +12,11 @@ void Bank::addAccount(BankAccount * account) {
accounts.insert(std::move(std::make_unique(account)));
}
+void Bank::moveMoney(std::shared_ptr bank, int amount) {
+ money -= amount;
+ bank->money -= amount;
+}
+
std::set> Bank::getAccounts() {
return accounts;
}
diff --git a/src/10_PITF/Testat/Bank.h b/src/10_PITF/Testat/Bank.h
index 14d0f33..922ee05 100644
--- a/src/10_PITF/Testat/Bank.h
+++ b/src/10_PITF/Testat/Bank.h
@@ -13,6 +13,7 @@ public:
explicit Bank(std::string name);
explicit Bank(Bank* bank);
void addAccount(BankAccount * account);
+ void moveMoney(std::shared_ptr bank, int amount);
std::set> getAccounts();
std::string getName();
};
diff --git a/src/10_PITF/Testat/BankAccount.cpp b/src/10_PITF/Testat/BankAccount.cpp
index a335aa2..9505fd3 100644
--- a/src/10_PITF/Testat/BankAccount.cpp
+++ b/src/10_PITF/Testat/BankAccount.cpp
@@ -2,6 +2,7 @@
#include
#include
+#include
#include "BankAccount.h"
#include "CashFactory.h"
diff --git a/src/10_PITF/Testat/Cash.cpp b/src/10_PITF/Testat/Cash.cpp
index 51dd580..8209bfa 100644
--- a/src/10_PITF/Testat/Cash.cpp
+++ b/src/10_PITF/Testat/Cash.cpp
@@ -3,6 +3,4 @@
#include "Cash.h"
-Cash::Cash(int value, Currency currency) : Money(value, currency) {
-
-}
\ No newline at end of file
+Cash::Cash(int value, Currency currency) : Money(value, currency) {}
\ No newline at end of file
diff --git a/src/10_PITF/Testat/HeapObject.cpp b/src/10_PITF/Testat/HeapObject.cpp
index 5740f37..d12b035 100644
--- a/src/10_PITF/Testat/HeapObject.cpp
+++ b/src/10_PITF/Testat/HeapObject.cpp
@@ -12,6 +12,9 @@ void* HeapObject::operator new (size_t size){
return new char[size];
}
+
+
+
HeapObject::HeapObject(){
ctorCount++;
}
@@ -22,6 +25,7 @@ HeapObject::~HeapObject(){
bool HeapObject::assertionsHold(){
//assert(ctorCount == newCount); // all objects have been allocated on heap
+ std::cout << ctorCount << " : " << dtorCount << std::endl;
assert(ctorCount == dtorCount); // all objects have been deleted
return true;
-}
+}
\ No newline at end of file
diff --git a/src/10_PITF/Testat/main.cpp b/src/10_PITF/Testat/main.cpp
index c97ee7e..057ebc2 100644
--- a/src/10_PITF/Testat/main.cpp
+++ b/src/10_PITF/Testat/main.cpp
@@ -89,21 +89,34 @@ void simulate() {
std::shared_ptr bill = cashFactory->printBill(rnd, CurrencyValue::USD);
std::shared_ptr coin = cashFactory->printCoin(rnd, CurrencyValue::USD);
if (bill != nullptr) {
- *bankAccount + bill.get();
+ //*bankAccount + bill.get();
moneyVector.push_back(std::static_pointer_cast(bill));
}
if (coin != nullptr) {
- *bankAccount + coin.get();
+ //*bankAccount + coin.get();
moneyVector.push_back(std::static_pointer_cast(coin));
}
Money *fee = *bankAccount - 10;
+ delete fee;
}
- //FIXME: Das hier mag er nicht
- // std::cout << bankAccount->getOwner()->getName();
std::cout << bankAccount->getName() << ": ";
- std::cout << bankAccount->getMoney()->getValue() << " ";
- std::cout << bankAccount->getMoney()->getCurrency().getValue() << std::endl;
+ /*
+ * FIXME: Das hier mag er nicht
+ * std::cout << bankAccount->getMoney()->getValue() << " ";
+ * std::cout << bankAccount->getMoney()->getCurrency().getValue() << std::endl;
+ */
+ }
+ }
+
+ for(auto && bank1 : banks) {
+ for(auto && bank2 : banks) {
+ if(bank1 != bank2) {
+ for (int i = 0; i < 10000; ++i) {
+ int rnd = distribution(generator);
+ bank1->moveMoney(bank2, rnd);
+ }
+ }
}
}
@@ -113,10 +126,14 @@ void simulate() {
std::cout << money->getValue() << ", ";
}
std::cout << std::endl;
+
+
}
void tearDown() {
+ for(auto && bank : banks) {
+ }
}
@@ -128,7 +145,5 @@ int main(int argc, char **argv) {
std::cout << "+++++++++++++++++++++++++ " << "tearDown()" << " +++++++++++++++++++++++++" << std::endl;
tearDown();
- HeapObject::assertionsHold();
-
return 0;
}
\ No newline at end of file