minunit_test.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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_value_composer();
  14. void test_furi_value_manager();
  15. void test_furi_event();
  16. void test_furi_memmgr();
  17. static int foo = 0;
  18. void test_setup(void) {
  19. foo = 7;
  20. }
  21. void test_teardown(void) {
  22. /* Nothing */
  23. }
  24. MU_TEST(test_check) {
  25. mu_check(foo != 6);
  26. }
  27. MU_TEST(mu_test_furi_ac_create_kill) {
  28. mu_assert_int_eq(test_furi_ac_create_kill(), true);
  29. }
  30. MU_TEST(mu_test_furi_ac_switch_exit) {
  31. mu_assert_int_eq(test_furi_ac_switch_exit(), true);
  32. }
  33. // v2 tests
  34. MU_TEST(mu_test_furi_create_open) {
  35. test_furi_create_open();
  36. }
  37. MU_TEST(mu_test_furi_valuemutex) {
  38. test_furi_valuemutex();
  39. }
  40. MU_TEST(mu_test_furi_concurrent_access) {
  41. test_furi_concurrent_access();
  42. }
  43. MU_TEST(mu_test_furi_pubsub) {
  44. test_furi_pubsub();
  45. }
  46. MU_TEST(mu_test_furi_memmgr) {
  47. // this test is not accurate, but gives a basic understanding
  48. // that memory management is working fine
  49. test_furi_memmgr();
  50. }
  51. MU_TEST(mu_test_furi_value_expanders) {
  52. test_furi_value_composer();
  53. test_furi_value_manager();
  54. }
  55. MU_TEST(mu_test_furi_event) {
  56. test_furi_event();
  57. }
  58. MU_TEST_SUITE(test_suite) {
  59. MU_SUITE_CONFIGURE(&test_setup, &test_teardown);
  60. MU_RUN_TEST(test_check);
  61. MU_RUN_TEST(mu_test_furi_ac_create_kill);
  62. MU_RUN_TEST(mu_test_furi_ac_switch_exit);
  63. // v2 tests
  64. MU_RUN_TEST(mu_test_furi_create_open);
  65. MU_RUN_TEST(mu_test_furi_valuemutex);
  66. MU_RUN_TEST(mu_test_furi_concurrent_access);
  67. MU_RUN_TEST(mu_test_furi_pubsub);
  68. MU_RUN_TEST(mu_test_furi_value_expanders);
  69. MU_RUN_TEST(mu_test_furi_event);
  70. MU_RUN_TEST(mu_test_furi_memmgr);
  71. }
  72. int run_minunit() {
  73. MU_RUN_SUITE(test_suite);
  74. MU_REPORT();
  75. return MU_EXIT_CODE;
  76. }