Spexygen Reference Manual 3.0.0
Loading...
Searching...
No Matches
test2.c
Go to the documentation of this file.
1#include "header.h"
2#include "unity.h"
3
4void setUp(void) {
5}
6
7void tearDown(void) {
8}
9
10/*!
11@code_uid{TUN_PRJ_Foo_ctor_01, constructor test}
12@code_litem{Details}
13This test checks that Foo_ctor() produces valid instance.
14@code_bw_trace{brief}
15- [@tr{SRS_EXA_REQ_12}] <i>Class Foo shall provide a constructor.</i>
16- [@tr{Foo_ctor()}] <i>Constructor of class Foo brief description</i>
17@endcode_uid
18*/
20 Foo_ctor(&Foo_inst, 0x12345678);
21 TEST_ASSERT_EQUAL_INT32(0x12345678, Foo_inst.x);
22 TEST_ASSERT_EQUAL_INT32(~0x12345678, Foo_inst.x_dis);
23}
24
25/*!
26@code_uid{TUN_PRJ_Foo_verify_00, verify positive test}
27@code_litem{Details}
28This test checks that Foo_verify_() distinguishes valid instance.
29@code_bw_trace{brief}
30- [@tr{SRS_EXA_REQ_13}] <i>@badge{safety} Class Foo shall provide a verify operation.</i>
31- [@tr{Foo_verify_()}] <i>Verify operation to check the class invariant</i>
32@endcode_uid
33*/
35 Foo_ctor(&Foo_inst, 0x12345678);
36 TEST_ASSERT_TRUE(Foo_verify_(&Foo_inst));
37}
38
39/*!
40@code_uid{TUN_PRJ_Foo_verify_01, verify negative test}
41@code_litem{Details}
42This test checks that Foo_verify_() distinguishes invalid instance.
43@code_bw_trace{brief}
44- [@tr{SRS_EXA_REQ_13}] <i>@badge{safety} Class Foo shall provide a verify operation.</i>
45- [@tr{Foo_verify_()}] <i>Verify operation to check the class invariant</i>
46@endcode_uid
47*/
49 Foo_ctor(&Foo_inst, 0x12345678);
50 Foo_inst.x -= 1; // change x
51 TEST_ASSERT_FALSE(Foo_verify_(&Foo_inst));
52}
a header file in the project
void Foo_ctor(Foo *const me, uint32_t const x)
Definition source.c:14
bool Foo_verify_(Foo const *const me)
Definition source.c:23
Foo Foo_inst
Definition source.c:12
uint32_t x_dis
Duplicate Inverse Storage for attribute Foo::x.
Definition header.h:20
uint32_t x
Attribute x of class Foo brief description.
Definition header.h:19
void setUp(void)
Definition test1.c:4
void tearDown(void)
Definition test1.c:7
void TUN_PRJ_Foo_verify_01(void)
verify negative test
Definition test2.c:48
void TUN_PRJ_Foo_verify_00(void)
verify positive test
Definition test2.c:34
void TUN_PRJ_Foo_ctor_01(void)
constructor test
Definition test2.c:19