@@ -159,6 +159,63 @@ FOSSIL_TEST_CASE(cpp_xbdd_invalid_login) {
159159 }
160160} // end of case
161161
162+ FOSSIL_TEST_CASE (cpp_xbdd_insufficient_balance) {
163+ GIVEN (" a user's account with insufficient balance" ) {
164+ // Set up the context
165+ float accountBalance = 100.0 ;
166+ float withdrawalAmount = 200.0 ;
167+
168+ WHEN (" the user requests a withdrawal of $200" ) {
169+ // Perform the withdrawal action
170+ bool withdrawalSuccess = false ;
171+ if (accountBalance >= withdrawalAmount) {
172+ accountBalance -= withdrawalAmount;
173+ withdrawalSuccess = true ;
174+ }
175+
176+ THEN (" the withdrawal should fail and balance should remain unchanged" ) {
177+ // Check the expected outcome
178+ FOSSIL_TEST_ASSUME (!withdrawalSuccess, " Withdrawal should not succeed" );
179+ FOSSIL_TEST_ASSUME (accountBalance == 100.0 , " Account balance should remain unchanged" );
180+ }
181+ }
182+ }
183+ } // end of case
184+
185+ FOSSIL_TEST_CASE (cpp_xbdd_add_multiple_items_to_cart) {
186+ GIVEN (" a user with an empty shopping cart" ) {
187+ // Set up the context
188+ int cartItemCount = 0 ;
189+
190+ WHEN (" the user adds three products to the cart" ) {
191+ // Perform the action of adding products
192+ cartItemCount += 3 ;
193+
194+ THEN (" the cart item count should increase by 3" ) {
195+ // Check the expected outcome
196+ FOSSIL_TEST_ASSUME (cartItemCount == 3 , " Cart item count should have increased by 3" );
197+ }
198+ }
199+ }
200+ } // end of case
201+
202+ FOSSIL_TEST_CASE (cpp_xbdd_remove_item_from_cart) {
203+ GIVEN (" a user with a shopping cart containing 2 items" ) {
204+ // Set up the context
205+ int cartItemCount = 2 ;
206+
207+ WHEN (" the user removes one product from the cart" ) {
208+ // Perform the action of removing a product
209+ cartItemCount--;
210+
211+ THEN (" the cart item count should decrease by 1" ) {
212+ // Check the expected outcome
213+ FOSSIL_TEST_ASSUME (cartItemCount == 1 , " Cart item count should have decreased by 1" );
214+ }
215+ }
216+ }
217+ } // end of case
218+
162219// * * * * * * * * * * * * * * * * * * * * * * * *
163220// * Fossil Logic Test Pool
164221// * * * * * * * * * * * * * * * * * * * * * * * *
@@ -168,6 +225,9 @@ FOSSIL_TEST_GROUP(cpp_bdd_test_cases) {
168225 FOSSIL_TEST_ADD (cpp_bdd_suite, cpp_xbdd_empty_cart);
169226 FOSSIL_TEST_ADD (cpp_bdd_suite, cpp_xbdd_valid_login);
170227 FOSSIL_TEST_ADD (cpp_bdd_suite, cpp_xbdd_invalid_login);
228+ FOSSIL_TEST_ADD (cpp_bdd_suite, cpp_xbdd_insufficient_balance);
229+ FOSSIL_TEST_ADD (cpp_bdd_suite, cpp_xbdd_add_multiple_items_to_cart);
230+ FOSSIL_TEST_ADD (cpp_bdd_suite, cpp_xbdd_remove_item_from_cart);
171231
172232 FOSSIL_TEST_REGISTER (cpp_bdd_suite);
173233} // end of group
0 commit comments