Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

57 wiersze
1.1 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include <lol/main.h>
  14. #include <lolunit.h>
  15. namespace lol
  16. {
  17. lolunit_declare_fixture(ThreadTest)
  18. {
  19. void SetUp() {}
  20. void TearDown() {}
  21. lolunit_declare_test(QueueTryPush)
  22. {
  23. Queue<int, 1> q;
  24. bool b1 = q.TryPush(0);
  25. lolunit_assert_equal(true, b1);
  26. bool b2 = q.TryPush(1);
  27. lolunit_assert_equal(false, b2);
  28. }
  29. lolunit_declare_test(QueueTryPop)
  30. {
  31. Queue<int, 1> q;
  32. int tmp;
  33. q.Push(42);
  34. bool b1 = q.TryPop(tmp);
  35. lolunit_assert_equal(true, b1);
  36. lolunit_assert_equal(42, tmp);
  37. bool b2 = q.TryPop(tmp);
  38. lolunit_assert_equal(false, b2);
  39. lolunit_assert_equal(42, tmp);
  40. }
  41. };
  42. } /* namespace lol */