main.c 993 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * OpenHMD - Free and Open Source API and drivers for immersive technology.
  3. * Copyright (C) 2013 Fredrik Hultin.
  4. * Copyright (C) 2013 Jakob Bornecrantz.
  5. * Distributed under the Boost 1.0 licence, see LICENSE for full text.
  6. */
  7. /* Unit Tests - Main */
  8. #include <string.h>
  9. #include "tests.h"
  10. bool float_eq(float a, float b, float t)
  11. {
  12. return fabsf(a - b) < t;
  13. }
  14. #define Test(_t) printf(" "#_t); _t(); printf("%*sok\n", 50 - (int)strlen(#_t), "");
  15. int main()
  16. {
  17. printf("vec3f tests\n");
  18. Test(test_ovec3f_normalize_me);
  19. Test(test_ovec3f_get_length);
  20. Test(test_ovec3f_get_angle);
  21. Test(test_ovec3f_get_dot);
  22. printf("\n");
  23. printf("quatf tests\n");
  24. Test(test_oquatf_init_axis);
  25. Test(test_oquatf_get_rotated);
  26. Test(test_oquatf_get_dot);
  27. Test(test_oquatf_inverse);
  28. Test(test_oquatf_diff);
  29. printf("\n");
  30. printf("high level tests\n");
  31. Test(test_highlevel_open_close_device);
  32. Test(test_highlevel_open_close_many_devices);
  33. printf("\n");
  34. printf("all a-ok\n");
  35. return 0;
  36. }