furi_test.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include <stdio.h>
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. #include "../minunit.h"
  5. // v2 tests
  6. void test_furi_create_open();
  7. void test_furi_valuemutex();
  8. void test_furi_concurrent_access();
  9. void test_furi_pubsub();
  10. void test_furi_memmgr();
  11. static int foo = 0;
  12. void test_setup(void) {
  13. foo = 7;
  14. }
  15. void test_teardown(void) {
  16. /* Nothing */
  17. }
  18. MU_TEST(test_check) {
  19. mu_check(foo != 6);
  20. }
  21. // v2 tests
  22. MU_TEST(mu_test_furi_create_open) {
  23. test_furi_create_open();
  24. }
  25. MU_TEST(mu_test_furi_valuemutex) {
  26. test_furi_valuemutex();
  27. }
  28. MU_TEST(mu_test_furi_pubsub) {
  29. test_furi_pubsub();
  30. }
  31. MU_TEST(mu_test_furi_memmgr) {
  32. // this test is not accurate, but gives a basic understanding
  33. // that memory management is working fine
  34. test_furi_memmgr();
  35. }
  36. MU_TEST_SUITE(test_suite) {
  37. MU_SUITE_CONFIGURE(&test_setup, &test_teardown);
  38. MU_RUN_TEST(test_check);
  39. // v2 tests
  40. MU_RUN_TEST(mu_test_furi_create_open);
  41. MU_RUN_TEST(mu_test_furi_valuemutex);
  42. MU_RUN_TEST(mu_test_furi_pubsub);
  43. MU_RUN_TEST(mu_test_furi_memmgr);
  44. }
  45. int run_minunit_test_furi() {
  46. MU_RUN_SUITE(test_suite);
  47. return MU_EXIT_CODE;
  48. }