minunit_test.c 1.9 KB

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