minunit_test.c 1.7 KB

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