> On 04 May 2016, at 13:02, [email protected] wrote:
>
> From: Max <[email protected]>
>
> Move copy-pasted code into separate function to make writing more tests
> easier.
and change behavior..
> +static void test_subs(const char *alice_imsi, char *imei1, char *imei2)
> {
> - char scratch_str[256];
> + struct gsm_subscriber *alice = NULL, *alice_db;
> + char scratch_str[256];
tabs vs. spaces
> + /* Get by extension */
> + alice_db = db_get_subscriber(GSM_SUBSCRIBER_EXTENSION,
> alice->extension);
> + if (alice_db) {
> + COMPARE(alice, alice_db);
> + SUBSCR_PUT(alice_db);
> + }
> + SUBSCR_PUT(alice);
The if looks a bit weak here? So no error if the look-up code starts to break?
In general I think we want to have strong post conditions. If alice_db should
be !NULL then we should aggressively check for it.