You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

49 lines
1.1 KiB

  1. //
  2. // Lol Engine — Unit tests
  3. //
  4. // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net>
  5. // © 2014—2015 Benjamin “Touky” Huet <huet.benjamin@gmail.com>
  6. // © 2014—2015 Guillaume Bittoun <guillaume.bittoun@gmail.com>
  7. //
  8. // Lol Engine is free software. It comes without any warranty, to
  9. // the extent permitted by applicable law. You can redistribute it
  10. // and/or modify it under the terms of the Do What the Fuck You Want
  11. // to Public License, Version 2, as published by the WTFPL Task Force.
  12. // See http://www.wtfpl.net/ for more details.
  13. //
  14. #include <lol/engine-internal.h>
  15. #include <lolunit.h>
  16. #include <iostream>
  17. namespace lol
  18. {
  19. lolunit_declare_fixture(timer_test)
  20. {
  21. void setup()
  22. {
  23. }
  24. void teardown()
  25. {
  26. }
  27. lolunit_declare_test(timers)
  28. {
  29. timer t0, t1;
  30. t0.wait(1.5);
  31. float s0 = t1.poll();
  32. float s1 = t1.get();
  33. lolunit_assert_doubles_equal(s0, s1, 1e-5);
  34. lolunit_assert_doubles_equal(1.5, s1, 1e-3);
  35. t1.wait(1.5);
  36. lolunit_assert_doubles_equal(3.0, t0.get(), 1e-3);
  37. }
  38. };
  39. }