Skip to content
14 changes: 9 additions & 5 deletions exercises/practice/bank-account/bank_account_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TEST_CASE("Can do multiple operations sequentially",
REQUIRE(account.balance() == 20);
}

TEST_CASE("annot check balance of closed account",
TEST_CASE("Cannot check balance of closed account",
"[f9facfaa-d824-486e-8381-48832c4bbffd]") {
Bankaccount::Bankaccount account{};
account.open();
Expand Down Expand Up @@ -150,12 +150,16 @@ TEST_CASE("Can handle concurrent transactions",

std::vector<std::thread> vec_of_threads;

for (int i = 0; i < 1000; ++i) {
for (int i = 0; i < 10; ++i) {
vec_of_threads.push_back(std::thread([&]() {
using namespace std::chrono_literals;
account.deposit(1);
std::this_thread::sleep_for(5ms);
account.withdraw(1);
for (int j{0}; j < 100; ++j) {
account.deposit(1);
std::this_thread::sleep_for(1ms);
}
for (int j{0}; j < 100; ++j) {
account.withdraw(1);
}
}));
}

Expand Down