static void takeCardTest(){ ostringstream oss; Stock stock = Stock(); vector<int> list(30,5); stock += list; int size = stock.getSize(); for(int i = 0; i < 30; i++){ assert(stock.takeCard() == 5); assert(stock.getSize() == --size); } assert(stock.isEmpty()); try { stock.takeCard(); } catch(std::logic_error & e){ oss << e.what(); } cout << oss.str(); }
static void constructorTest() { Stock s = Stock(); assert(s.getSize() == 0); assert(s.isEmpty()); }