minunit_test.c 1.2 KB

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