More about the Shopping Cart Module

Welcome to your fourth unit for this course, dedicated to practicing Test Driven Development (TDD). We're going to continue building our ShoppingCart system by adding even more features.

In this course, emphasis is placed on hands-on practice, where you'll receive requirements through tests, one at a time. Your task is to write tests and implement code that makes each test pass, simulating a real-world TDD environment.

Remember to use the core concepts of the Red-Green-Refactor cycle while completing these coding exercises. I'm still here to help! Just ask.

More Requirements for `ShoppingCart` Class
6. Removing a Non-Existent Item
  • Description: Attempting to remove an item that is not present in the cart should be handled through exception handling in C++.
  • Details
    • Implement the removal through a RemoveItem(int id) method.
    • Ensure the method uses throw to generate an exception if the item is not found.
    • When testing, use Google Test's EXPECT_THROW macro to verify that the correct exception is thrown with the expected message.
    • Use std::runtime_error to represent the exception with the message "Item not found".
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal