minunit_test.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. bool test_furi_nonexistent_data();
  9. bool test_furi_mute_algorithm();
  10. // v2 tests
  11. void test_furi_create_open();
  12. void test_furi_valuemutex();
  13. void test_furi_concurrent_access();
  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. MU_TEST(mu_test_furi_nonexistent_data) {
  31. mu_assert_int_eq(test_furi_nonexistent_data(), 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_SUITE(test_suite) {
  44. MU_SUITE_CONFIGURE(&test_setup, &test_teardown);
  45. MU_RUN_TEST(test_check);
  46. MU_RUN_TEST(mu_test_furi_ac_create_kill);
  47. MU_RUN_TEST(mu_test_furi_ac_switch_exit);
  48. MU_RUN_TEST(mu_test_furi_nonexistent_data);
  49. // v2 tests
  50. MU_RUN_TEST(mu_test_furi_create_open);
  51. MU_RUN_TEST(mu_test_furi_valuemutex);
  52. MU_RUN_TEST(mu_test_furi_concurrent_access);
  53. }
  54. int run_minunit() {
  55. MU_RUN_SUITE(test_suite);
  56. MU_REPORT();
  57. return MU_EXIT_CODE;
  58. }