minunit_test.c 1.6 KB

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