@@ -77,23 +77,32 @@ void Test_BinSem(void)
7777 char long_name [OS_MAX_API_NAME + 1 ];
7878 OS_bin_sem_prop_t sem_prop ;
7979 uint32 test_val ;
80- bool get_info_implemented ;
80+ bool get_value_implemented ;
8181
8282 memset (& sem_prop , 0 , sizeof (sem_prop ));
8383 memset (task_counter , 0 , sizeof (task_counter ));
8484
8585 /* Invalid id checks */
86- UtAssert_INT32_EQ (OS_BinSemGetInfo (OS_OBJECT_ID_UNDEFINED , & sem_prop ), OS_ERR_INVALID_ID );
86+ UtAssert_INT32_EQ (OS_BinSemGetName (OS_OBJECT_ID_UNDEFINED , & sem_prop ), OS_ERR_INVALID_ID );
87+ UtAssert_INT32_EQ (OS_BinSemGetCreator (OS_OBJECT_ID_UNDEFINED , & sem_prop ), OS_ERR_INVALID_ID );
88+ UtAssert_INT32_EQ (OS_BinSemGetValue (OS_OBJECT_ID_UNDEFINED , & sem_prop ), OS_ERR_INVALID_ID );
8789 UtAssert_INT32_EQ (OS_BinSemFlush (OS_OBJECT_ID_UNDEFINED ), OS_ERR_INVALID_ID );
8890 UtAssert_INT32_EQ (OS_BinSemGive (OS_OBJECT_ID_UNDEFINED ), OS_ERR_INVALID_ID );
8991 UtAssert_INT32_EQ (OS_BinSemTake (OS_OBJECT_ID_UNDEFINED ), OS_ERR_INVALID_ID );
9092 UtAssert_INT32_EQ (OS_BinSemTimedWait (OS_OBJECT_ID_UNDEFINED , 0 ), OS_ERR_INVALID_ID );
9193 UtAssert_INT32_EQ (OS_BinSemDelete (OS_OBJECT_ID_UNDEFINED ), OS_ERR_INVALID_ID );
9294
93- /* Null checks */
95+ /* OS_BinSemCreate NULL checks */
9496 UtAssert_INT32_EQ (OS_BinSemCreate (NULL , "Test_Sem" , 0 , 0 ), OS_INVALID_POINTER );
9597 UtAssert_INT32_EQ (OS_BinSemCreate (& sem_id [0 ], NULL , 0 , 0 ), OS_INVALID_POINTER );
96- UtAssert_INT32_EQ (OS_BinSemGetInfo (sem_id [0 ], NULL ), OS_INVALID_POINTER );
98+
99+ // Initialize sem_id[0] to a valid value for the following NULL checks
100+ sem_id [0 ] = OS_OBJECT_ID_UNDEFINED ;
101+
102+ // OS_BinSemGet* NULL checks
103+ UtAssert_INT32_EQ (OS_BinSemGetName (sem_id [0 ], NULL ), OS_INVALID_POINTER );
104+ UtAssert_INT32_EQ (OS_BinSemGetCreator (sem_id [0 ], NULL ), OS_INVALID_POINTER );
105+ UtAssert_INT32_EQ (OS_BinSemGetValue (sem_id [0 ], NULL ), OS_INVALID_POINTER );
97106 UtAssert_INT32_EQ (OS_BinSemGetIdByName (NULL , "Test_Sem" ), OS_INVALID_POINTER );
98107 UtAssert_INT32_EQ (OS_BinSemGetIdByName (& sem_id [0 ], NULL ), OS_INVALID_POINTER );
99108
@@ -109,15 +118,15 @@ void Test_BinSem(void)
109118 /* Nonzero create */
110119 UtAssert_INT32_EQ (OS_BinSemCreate (& sem_id [1 ], "Test_Sem_Nonzero" , 1 , 0 ), OS_SUCCESS );
111120
112- /* Check get info implementation */
113- get_info_implemented = (OS_BinSemGetInfo (sem_id [0 ], & sem_prop ) != OS_ERR_NOT_IMPLEMENTED );
121+ /* Check get value implementation */
122+ get_value_implemented = (OS_BinSemGetValue (sem_id [0 ], & sem_prop ) != OS_ERR_NOT_IMPLEMENTED );
114123
115124 /* Validate values */
116- if (get_info_implemented )
125+ if (get_value_implemented )
117126 {
118- UtAssert_INT32_EQ (OS_BinSemGetInfo (sem_id [0 ], & sem_prop ), OS_SUCCESS );
127+ UtAssert_INT32_EQ (OS_BinSemGetValue (sem_id [0 ], & sem_prop ), OS_SUCCESS );
119128 UtAssert_INT32_EQ (sem_prop .value , 0 );
120- UtAssert_INT32_EQ (OS_BinSemGetInfo (sem_id [1 ], & sem_prop ), OS_SUCCESS );
129+ UtAssert_INT32_EQ (OS_BinSemGetValue (sem_id [1 ], & sem_prop ), OS_SUCCESS );
121130 UtAssert_INT32_EQ (sem_prop .value , 1 );
122131 }
123132
@@ -141,11 +150,11 @@ void Test_BinSem(void)
141150 UtAssert_INT32_EQ (OS_BinSemTimedWait (sem_id [1 ], 0 ), OS_SUCCESS );
142151
143152 /* Validate zeros */
144- if (get_info_implemented )
153+ if (get_value_implemented )
145154 {
146- UtAssert_INT32_EQ (OS_BinSemGetInfo (sem_id [0 ], & sem_prop ), OS_SUCCESS );
155+ UtAssert_INT32_EQ (OS_BinSemGetValue (sem_id [0 ], & sem_prop ), OS_SUCCESS );
147156 UtAssert_INT32_EQ (sem_prop .value , 0 );
148- UtAssert_INT32_EQ (OS_BinSemGetInfo (sem_id [1 ], & sem_prop ), OS_SUCCESS );
157+ UtAssert_INT32_EQ (OS_BinSemGetValue (sem_id [1 ], & sem_prop ), OS_SUCCESS );
149158 UtAssert_INT32_EQ (sem_prop .value , 0 );
150159 }
151160 else
@@ -162,9 +171,9 @@ void Test_BinSem(void)
162171 UtAssert_INT32_EQ (OS_TaskDelete (task_id [0 ]), OS_SUCCESS );
163172 UtAssert_UINT32_EQ (task_counter [0 ], 0 );
164173
165- if (get_info_implemented )
174+ if (get_value_implemented )
166175 {
167- UtAssert_INT32_EQ (OS_BinSemGetInfo (sem_id [0 ], & sem_prop ), OS_SUCCESS );
176+ UtAssert_INT32_EQ (OS_BinSemGetValue (sem_id [0 ], & sem_prop ), OS_SUCCESS );
168177 UtAssert_INT32_EQ (sem_prop .value , 0 );
169178 }
170179 else
0 commit comments