minunit_test.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include <stdio.h>
  2. #include <furi.h>
  3. #include "minunit_vars.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_concurrent_access) {
  29. test_furi_concurrent_access();
  30. }
  31. MU_TEST(mu_test_furi_pubsub) {
  32. test_furi_pubsub();
  33. }
  34. MU_TEST(mu_test_furi_memmgr) {
  35. // this test is not accurate, but gives a basic understanding
  36. // that memory management is working fine
  37. test_furi_memmgr();
  38. }
  39. MU_TEST_SUITE(test_suite) {
  40. MU_SUITE_CONFIGURE(&test_setup, &test_teardown);
  41. MU_RUN_TEST(test_check);
  42. // v2 tests
  43. MU_RUN_TEST(mu_test_furi_create_open);
  44. MU_RUN_TEST(mu_test_furi_valuemutex);
  45. MU_RUN_TEST(mu_test_furi_concurrent_access);
  46. MU_RUN_TEST(mu_test_furi_pubsub);
  47. MU_RUN_TEST(mu_test_furi_memmgr);
  48. }
  49. int run_minunit() {
  50. MU_RUN_SUITE(test_suite);
  51. MU_REPORT();
  52. return MU_EXIT_CODE;
  53. }