From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3LRh_XAoKB0Qsgxsyzxutmmuumrk.iustuzs0intuzs0insgor.uxm@flex--marmstrong.bounces.google.com> Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 05F626DE0E7E for ; Tue, 5 Mar 2019 16:45:35 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -7.83 X-Spam-Level: X-Spam-Status: No, score=-7.83 tagged_above=-999 required=5 tests=[AWL=-0.130, DKIMWL_WL_MED=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NGCDmXvkZXYy for ; Tue, 5 Mar 2019 16:45:34 -0800 (PST) Received: from mail-vs1-f73.google.com (mail-vs1-f73.google.com [209.85.217.73]) by arlo.cworth.org (Postfix) with ESMTPS id 213B46DE0C45 for ; Tue, 5 Mar 2019 16:45:34 -0800 (PST) Received: by mail-vs1-f73.google.com with SMTP id e63so527401vsc.2 for ; Tue, 05 Mar 2019 16:45:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to; bh=C2RJDJgkdBAwx2eMNHD4lZnC9klL23cM5JwjxIjyyJ4=; b=P74OIWokk79rxT4PA4pXh+ShxXNFwnQiq3rIpzuFPKlXUO0nRnd31L6uzIUQXiDlzN vc4HVX9wZYJDdOe8wpAcLO7eCfK5hdZPU+vSTPZtAwoZM8WKkWGTSPk0DHtYbDS0WAIZ MB6BzF1AazWoSY8vXbj5sar0G2iGF+Ez1DsnzVyPOjuZ682i/TUQJD/1xBCR5Q38RM+P 6EGCtyAQVzmLegMlDhn+VPApWOaTJR7uaMN8Qb0yI+9aIa/u9br+ZE3nQrpHqWBB6Ajw ZLVFPzPboDf5zYKyjke1UaCfx9D92gKTPigKX0xomIdjb1VC4zI6ShKgfrbKgu+BA/IN 0evg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=C2RJDJgkdBAwx2eMNHD4lZnC9klL23cM5JwjxIjyyJ4=; b=qQ2QufgKgrVGWG2eXETxnLcDhFIC4Puqk04fGRxZSUYskI5UXI2StqJ4gtMxAXfbsj guRhZ51ZDvCQaRJWv5eu7uz5bYacUqrtDeevSPVA2FV4uxGmMVHJppYBaZXc2Nr4scPE mYeU0albSb5bL9JlwWsbL58/eGSwAQ8JfNy5ASOGBWf424b8dUV4D9WitJ+FKGqtN3ep 3eAMs5QJ2dV3ysJ5l0Qd+vI9u4BnYePbhN/j3TBvD/KEAUdPK1X35bzN+gCEiE6kEQ/u 4dy2dGh2kCYYXUPHF7ytxXk/tATFsmun9Bq68FzViDhPekXdQFJ6vjo0I+WkQLofk+kY NCWw== X-Gm-Message-State: APjAAAX7tWGLFzztwAApDmu+CUssoCDxxdubGUmLUFbEYNkEImW4gWgz U0slF+pNipoSib+QmPQ4T0W7rvLbvmKhFJFO X-Google-Smtp-Source: APXvYqxZVfhdg9wsMIcWypMf80CS6eu1829t4mryMjTRabAp7YZEc0i4gMFSrAZI1JsF1LGapTtyVCK5+qHGH9KW X-Received: by 2002:a67:ebd1:: with SMTP id y17mr3433620vso.14.1551833133137; Tue, 05 Mar 2019 16:45:33 -0800 (PST) Date: Tue, 05 Mar 2019 16:45:29 -0800 In-Reply-To: <87o96pglwa.fsf@tethera.net> Message-Id: Mime-Version: 1.0 References: <20190302183412.6822-1-david@tethera.net> <87o96pglwa.fsf@tethera.net> Subject: Re: [PATCH] lib/string_map: fix return type of string_cmp From: Matt Armstrong To: David Bremner , notmuch@notmuchmail.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2019 00:45:35 -0000 David Bremner writes: > Matt Armstrong writes: > >> Perhaps some unit tests for _notmuch_string_map would be worthwhile? >> > > Thanks for the feedback. At first I thought this would be too hard/intrusive, > since the string_map functions are not exported, but I realized > n_message_property_get is a thin wrapper on _notmuch_string_map_get, so > I added the following test. Most of the searches fail before the patch. > > test_begin_subtest "testing string map binary search (via message properties)" > cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} > { > char *keys[] = {"a", "b", "c", "d", "e", NULL}; > for (int i=0; keys[i]; i++) > EXPECT0(notmuch_message_add_property (message, keys[i], keys[i])); > > for (int i=0; keys[i]; i++) { > EXPECT0(notmuch_message_get_property (message, keys[i], &val)); > printf("%s = %s\n", keys[i], val); > } > > for (int i=0; keys[i]; i++) > EXPECT0(notmuch_message_remove_property (message, keys[i], keys[i])); > } Nice. The test could even go further and verify that get_property fails after the properties are removed.