tasks_ut.cpp 907 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <library/cpp/testing/unittest/registar.h>
  2. #include "tasks.h"
  3. using namespace NActor;
  4. Y_UNIT_TEST_SUITE(TTasks) {
  5. Y_UNIT_TEST(AddTask_FetchTask_Simple) {
  6. TTasks tasks;
  7. UNIT_ASSERT(tasks.AddTask());
  8. UNIT_ASSERT(!tasks.AddTask());
  9. UNIT_ASSERT(!tasks.AddTask());
  10. UNIT_ASSERT(tasks.FetchTask());
  11. UNIT_ASSERT(!tasks.FetchTask());
  12. UNIT_ASSERT(tasks.AddTask());
  13. }
  14. Y_UNIT_TEST(AddTask_FetchTask_AddTask) {
  15. TTasks tasks;
  16. UNIT_ASSERT(tasks.AddTask());
  17. UNIT_ASSERT(!tasks.AddTask());
  18. UNIT_ASSERT(tasks.FetchTask());
  19. UNIT_ASSERT(!tasks.AddTask());
  20. UNIT_ASSERT(tasks.FetchTask());
  21. UNIT_ASSERT(!tasks.AddTask());
  22. UNIT_ASSERT(!tasks.AddTask());
  23. UNIT_ASSERT(tasks.FetchTask());
  24. UNIT_ASSERT(!tasks.FetchTask());
  25. UNIT_ASSERT(tasks.AddTask());
  26. }
  27. }