General Purpose library for Freestanding C++ and POSIX systems
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.

46 lines
831 B

  1. #include "test_scaffold.h"
  2. #include "gp/math.hpp"
  3. #include "gp/rendering/renderer.hpp"
  4. #include <cmath>
  5. struct sin_test : public test_scaffold {
  6. sin_test() {
  7. name = __FILE__ ":1";
  8. }
  9. virtual int run() {
  10. int res = 0;
  11. for(float i = 0; i < 100; i += 0.1) {
  12. float v = gp::sin(i);
  13. float ref = sin(i);
  14. res += 0.3 < gp::abs<float>(ref - v)*100.0/(gp::abs(ref+0.00000001));
  15. }
  16. for(float i = 0; i < 100; i += 0.1) {
  17. float v = gp::cos(i);
  18. float ref = cos(i);
  19. res += 0.3 < gp::abs<float>(ref - v)*100.0/(gp::abs(ref+0.00000001));
  20. }
  21. return res;
  22. }
  23. };
  24. append_test dummy_mldffh6f(new sin_test{});
  25. struct render_test : public test_scaffold {
  26. render_test() {
  27. name = __FILE__ ":2";
  28. }
  29. virtual int run() {
  30. int res = 0;
  31. renderer a;
  32. return res;
  33. }
  34. };
  35. append_test dummy_ml8576f(new render_test{});