cmocka: assert_in_set() for WERROR

Dimitris Gravanis dimgrav at gmail.com
Sat Aug 26 11:54:50 UTC 2017


Hi,

I want to check if a function returns one of the following WERROR 
definitions:

In werror_gen.h:

  * |WERR_NERR_SUCCESS W_ERROR=0x0|
  * |WERR_NOT_ENOUGH_MEMORY W_ERROR=0x8|
  * |WERR_DNS_ERROR_RCODE_NOTAUTH W_ERROR=0x2331|
  * |WERR_DNS_ERROR_RCODE_FORMAT_ERROR W_ERROR=0x2329|

Since werror is a uint32_t typedef, I believe the way to do it in cmocka is

|assert_in_set(test_werr, [0x0, 0x8, 0x2331, 0x2329], 4);|

but waf throws

|error: incompatible type for argument 1 of ‘_assert_in_set’  
assert_in_set(test_werr, werr_set, 4);|

even if I cast WERROR test_werr to uint32_t.

Any ideas on how to solve this?

Cheers, Dimitris


-- 
Δ. Γραβάνης | D. Gravanis



More information about the samba-technical mailing list