summaryrefslogtreecommitdiff
path: root/FreeRTOS-Plus/Test/CMock/test/system/test_interactions/unity_void_pointer_compare.yml
blob: 1a49b0cd3728ad8f044734ecda5539e9b3cae855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
#The purpose of this test is to verify we handle void pointers as memory compares
:cmock:
  :plugins:
  - :array
  :treat_as_array:
    VOID_PTR: unsigned char

:systest:
  :types: |
    #include "unity_internals.h"
    typedef void* VOID_PTR;

  :mockable: |
    void* ret_v_ptr(void);
    void get_v_ptr(void* ptr);
    void get_v_ptr_typedefed(VOID_PTR ptr);

  :source:
    :header: |
      void function_a(void);

    :code: |
      void function_a(void) {
        void* stuff = ret_v_ptr();
        get_v_ptr(stuff);
        get_v_ptr_typedefed((VOID_PTR)stuff);
      }

  :tests:
    :common: |
      void setUp(void) {}
      void tearDown(void) {}

    :units:
    - :pass: TRUE
      :should: 'handle passing working expects'
      :code: |
        test()
        {
          char* a = "Hello";
          char* b = "Hello";
          ret_v_ptr_ExpectAndReturn(a);
          get_v_ptr_Expect(b);
          get_v_ptr_typedefed_Expect((VOID_PTR)b);

          function_a();
        }

    - :pass: TRUE
      :should: 'handle passing array expects'
      :code: |
        test()
        {
          char* a = "Hello";
          char* b = "Hello";
          ret_v_ptr_ExpectAndReturn(a);
          get_v_ptr_ExpectWithArray(b,5);
          get_v_ptr_typedefed_ExpectWithArray((VOID_PTR)b,5);

          function_a();
        }

    - :pass: FALSE
      :should: 'handle failing expects'
      :code: |
        test()
        {
          char* a = "Hello";
          char* b = "Jello";
          ret_v_ptr_ExpectAndReturn(a);
          get_v_ptr_Expect(b);
          get_v_ptr_typedefed_Expect((VOID_PTR)b);

          function_a();
        }

    - :pass: FALSE
      :should: 'handle failing array expects'
      :code: |
        test()
        {
          char* a = "Hello";
          char* b = "Hella";
          ret_v_ptr_ExpectAndReturn(a);
          get_v_ptr_ExpectWithArray(b,5);
          get_v_ptr_typedefed_ExpectWithArray((VOID_PTR)b,5);

          function_a();
        }
...