Advertisement
cepxuozab

Parking

Feb 23rd, 2024
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. void Incompleted() {
  2. Parking<TestClock> parking(10);
  3.  
  4. TestClock::SetNow(20);
  5. parking.Park({'B', 'B', 222, 'B', 99});
  6.  
  7. TestClock::SetNow(40);
  8. assert(parking.GetCurrentBill({'B', 'B', 222, 'B', 99}) == 200);
  9.  
  10. TestClock::SetNow(60);
  11. assert(parking.GetCurrentBill({'B', 'B', 222, 'B', 99}) == 400);
  12. }
  13.  
  14. void TestContainers() {
  15. Parking<TestClock> parking(10);
  16.  
  17.  
  18. TestClock::SetNow(10);
  19. parking.Park({'A', 'A', 111, 'A', 99});
  20.  
  21.  
  22. TestClock::SetNow(20);
  23. parking.Withdraw({'A', 'A', 111, 'A', 99});
  24. parking.Park({'B', 'B', 222, 'B', 99});
  25.  
  26.  
  27.  
  28. TestClock::SetNow(40);
  29. assert(parking.GetCurrentBill({'A', 'A', 111, 'A', 99}) == 100);
  30. assert(parking.GetCurrentBill({'B', 'B', 222, 'B', 99}) == 200);
  31. parking.Park({'A', 'A', 111, 'A', 99});
  32.  
  33.  
  34.  
  35. TestClock::SetNow(60);
  36. assert(parking.GetCurrentBill({'A', 'A', 111, 'A', 99}) == 300);
  37. assert(parking.GetCurrentBill({'B', 'B', 222, 'B', 99}) == 400);
  38. assert(parking.GetCurrentBill({'C', 'C', 333, 'C', 99}) == 0);
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement