From patchwork Mon Jul 22 05:57:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Pratap X-Patchwork-Id: 13738319 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A053317BA7 for ; Mon, 22 Jul 2024 06:19:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721629184; cv=none; b=OrEwT82t8g1Zu9g1vh8/VUUQd8UnRPZoq60L+FL4yPjygNDOHwfXuVr4qlurxjUmPh7iJtZWlrmIuGC7BRtKUmw1BlgvJpHRwiCO2fPMoY2F9ppety5PhsZpW3KazMDiebgnuhkXgUXQShYmiH9VphEKv7aqL/vdhQZKyvo6uVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721629184; c=relaxed/simple; bh=6dcZwXz7GFp7iAldfAYFiGDg1AfVonu0hu3Z6u9wQN4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i7869EiEsVzQ/f1PVJwMB50VtEB3uiNAirwbLwZhEiKfg/3gpE16VOzFGJ00Kc9bIlbB0NOWQZVmuj/hea0UDTXmCtlT/szp6xYayAgWVEFZ0OFh32G0ZJ3TMOdhdlr/+dtjDkhHs4W4XIUk+mmPA0yDcn/sxwAX0A6ExB5PGnE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CwQcg2Il; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CwQcg2Il" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1fa9ecfb321so25173535ad.0 for ; Sun, 21 Jul 2024 23:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721629182; x=1722233982; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nIDjQDvcxNu4l7Bz0MrT/RMIwMtJCJpsOd0bgbZFxZ8=; b=CwQcg2IlYmyv58dhgJyw+JWsHrsgxKGH2X3xdWtbnWVofSpC9Uoeq5FvoQADDCUspw biV3OiRosxWfp6Khvb5tfvkpVNg7ncGQ8UoMujV/D9zhYPFdpNKBR7wY0NoqbYrxGuSe LFrux/NR5e7DhIIj92T/U9lgH1CtEGb2SX7+fnIjcwpnHEsrLwmqR6FSx3NzAA5n2d6C P+jHNfTcN/b9lbbKV/zBZ5TsHUi8HXd/f8RY5mb3uj8craqeodQZhpjfzt16kkMC9g/9 MGdgQ7GyeBHvsAKhnQCjaMhU7tEgJj1mysUowL9enMMa9a0BJpsc6IvIg6YTLMLOMPFN VghA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721629182; x=1722233982; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nIDjQDvcxNu4l7Bz0MrT/RMIwMtJCJpsOd0bgbZFxZ8=; b=AhkCyA5rS2M1qciCau87xlzwqtNJH3PTO1cElICHlbnBr1vdxwZJi+xkNsndpx38/i iJbVUMRtPIOp6GYtoqqyQRhO7gUnXDwEQQOyoltyDQa4n4+1G5Afhqo6EoZ1RndufvEs GB0h4IOzbHzw4MD+qD+POJZe6EM4dvM96SlFFt7CSglBsEYrQVvPBjdPkpQW5Y2eA/u/ w/5vMFdmrfCQn+oCSRxUE3WYKUsLEUpgWXq7OTMuJNFDTtj6+CPINq1tdFoGhEPHYJpa g6cw4L43VzApfITh+PI+Yl2SjGnqJgaAm+pDI7TQJOw39vt5TaoM9UYNW3CoFQ562Tfp vKeQ== X-Gm-Message-State: AOJu0YwmgT6OO3MsYQE/mVCSveqC1+FJ9FvG4aDmXA2fHR7FMi1ox0QL zWP+N8u/tNmCv+xELg5bsGfS1jAxNU4kw8TJYMiPAp1+8uG8glVu9xh+Grw+q60= X-Google-Smtp-Source: AGHT+IGW1G58HzjLSG4jJo5KcxBWs9QbzjB8hKu299863ThZS8FEmHaQhfWVHFwpJ+knR8lvGOYH+g== X-Received: by 2002:a17:902:e5ce:b0:1fd:8bed:6645 with SMTP id d9443c01a7336-1fd8bed6b8emr19603595ad.61.1721629181439; Sun, 21 Jul 2024 23:19:41 -0700 (PDT) Received: from Ubuntu.. ([106.220.63.154]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-1fd6f31a73csm46362885ad.143.2024.07.21.23.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jul 2024 23:19:41 -0700 (PDT) From: Chandra Pratap To: git@vger.kernel.org Cc: karthik188@gmail.com, chriscool@tuxfamily.org Subject: [PATCH v5 1/5] reftable: remove unnecessary curly braces in reftable/tree.c Date: Mon, 22 Jul 2024 11:27:54 +0530 Message-ID: <20240722061836.4176-2-chandrapratap3519@gmail.com> X-Mailer: git-send-email 2.45.GIT In-Reply-To: <20240722061836.4176-1-chandrapratap3519@gmail.com> References: <20240716075641.4264-1-chandrapratap3519@gmail.com> <20240722061836.4176-1-chandrapratap3519@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 According to Documentation/CodingGuidelines, single-line control-flow statements must omit curly braces (except for some special cases). Make reftable/tree.c adhere to this guideline. Mentored-by: Patrick Steinhardt Mentored-by: Christian Couder Signed-off-by: Chandra Pratap --- reftable/tree.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/reftable/tree.c b/reftable/tree.c index 528f33ae38..5ffb2e0d69 100644 --- a/reftable/tree.c +++ b/reftable/tree.c @@ -39,25 +39,20 @@ struct tree_node *tree_search(void *key, struct tree_node **rootp, void infix_walk(struct tree_node *t, void (*action)(void *arg, void *key), void *arg) { - if (t->left) { + if (t->left) infix_walk(t->left, action, arg); - } action(arg, t->key); - if (t->right) { + if (t->right) infix_walk(t->right, action, arg); - } } void tree_free(struct tree_node *t) { - if (!t) { + if (!t) return; - } - if (t->left) { + if (t->left) tree_free(t->left); - } - if (t->right) { + if (t->right) tree_free(t->right); - } reftable_free(t); } From patchwork Mon Jul 22 05:57:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Pratap X-Patchwork-Id: 13738320 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52EE41803D for ; Mon, 22 Jul 2024 06:19:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721629186; cv=none; b=WqbBfrqENnJkY5QemDZbyJWOhtG9SknQ0uVCZFtJwUra6r+qtkY46dqPOZjeNmZH9QlJyNiiuFvHPwwvNlW/d+HpLyDfTIWng8ZXqmHl3nA2674jCk9b6IwUDHnhDRXn8RN8AhTqEkw8aM+U5hh9rwAdC/ziHFgrUIe6GvIfC8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721629186; c=relaxed/simple; bh=GUly1VZkQGe0cw4YB77AS8wApfqn6CPBiLJEpl/kArY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g+YN+xyL6u3y8zQVAi0zHz6AhIxnAVWsEAdpV+8Yx3ooKob1ZJsDe6AIGqBPjl+/yCzLIE/zgj7Q8EDE0JY4e4Tam/Bn86TZUO7FcpP0D7nEWNlZT7HAwmKqyMtVHEl9Srjwtc1aZghPEBL550qPS6I7dEg08dkdYno2MdRty2o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bUhpR+2x; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bUhpR+2x" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-70d1d818c42so392655b3a.1 for ; Sun, 21 Jul 2024 23:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721629184; x=1722233984; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hHM1L31DQScWXJMa3zRlE+YntQH8KZ8OkTFwiO2vZFE=; b=bUhpR+2x7rwrYcUNFminOxO2Z1cLCyGYJoBAoR1/+Lr2yONBl54sb8cvM7m7SqQeSi ncgFJaPLZnAIweQLWVLtMpEtwus+gyAhwAZC1jjX4EIgFH2OsDr3XCgTcfEcnbO9I7Rv o4DpXYCy1U4eirugPHQH6aO5FUQvcD9R734YbYLQk/SNxfMbGt+t8KTlGNSVD7Yl0EVX a9YamRAtDhUkscdzqzmOF4U8R9r05+Blro4jD5hGs443w4NPGNW8etgxEpZmDFmZZh+2 tdKPq9E2FEFAcaqY8mjtFc+kdkT3dTDfykR7QXVw8sZ0LOuEKvhUOFMyoCTSJ6bAI1pc o5Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721629184; x=1722233984; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hHM1L31DQScWXJMa3zRlE+YntQH8KZ8OkTFwiO2vZFE=; b=YO2JsAKyUcuYy/VFb7BuwWhWDWIXPklqW2ZnEYawdxnsDS9CLJFAe7BFovbq7WTdRt IjtP7Z/UNmcIbLWWKIw+H2NGXG6zQju+ii2tG1tYpWSuxAq1buYaZj8WBhXW5mga+aB6 Ww53w9jdNIy0UxHDZQM2Mf4p3n6kizvnjZZaLaJuN81KoN6aL/WIS/x697EGxnQb1OKG GMgQQkjdQLhv5Nc/LdKYF4Rcd6/3rS36nZT4IuDoQ2Mi/1SjEIQ5S9yL8EJLUTfRefG6 htx2sEdnp2q/5V/hVRb9R7Z5GEFroaCktc3hzm5+A9dWpH003V5OkOCnjM7T7PknU5HX VN2A== X-Gm-Message-State: AOJu0Yx/BzuHzsc0nYvOUXfCAAe+yIh8mxoUmHRFOiiq1YgS9Cd6GazQ H8+x9cu8pJRAhyko54M55juH0Em0/ZL8up14DloTVvfSLEm/dLurI2cjMFt5sKE= X-Google-Smtp-Source: AGHT+IErPnyfX6OpZIEDYgmawqxBAXy9onjA/nreHcxRnvn8J8413c/75tWmdQG6N3DE9TQANqlcnQ== X-Received: by 2002:a05:6a20:7489:b0:1c2:93eb:c178 with SMTP id adf61e73a8af0-1c4286194e6mr3746673637.51.1721629183955; Sun, 21 Jul 2024 23:19:43 -0700 (PDT) Received: from Ubuntu.. ([106.220.63.154]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-1fd6f31a73csm46362885ad.143.2024.07.21.23.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jul 2024 23:19:43 -0700 (PDT) From: Chandra Pratap To: git@vger.kernel.org Cc: karthik188@gmail.com, chriscool@tuxfamily.org Subject: [PATCH v5 2/5] t: move reftable/tree_test.c to the unit testing framework Date: Mon, 22 Jul 2024 11:27:55 +0530 Message-ID: <20240722061836.4176-3-chandrapratap3519@gmail.com> X-Mailer: git-send-email 2.45.GIT In-Reply-To: <20240722061836.4176-1-chandrapratap3519@gmail.com> References: <20240716075641.4264-1-chandrapratap3519@gmail.com> <20240722061836.4176-1-chandrapratap3519@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 reftable/tree_test.c exercises the functions defined in reftable/tree.{c, h}. Migrate reftable/tree_test.c to the unit testing framework. Migration involves refactoring the tests to use the unit testing framework instead of reftable's test framework and renaming the tests to align with unit-tests' standards. Also add a comment to help understand the test routine. Note that this commit mostly moves the test from reftable/ to t/unit-tests/ and most of the refactoring is performed by the trailing commits. Mentored-by: Patrick Steinhardt Mentored-by: Christian Couder Signed-off-by: Chandra Pratap --- Makefile | 2 +- reftable/reftable-tests.h | 1 - reftable/tree_test.c | 60 ---------------------------------- t/helper/test-reftable.c | 1 - t/unit-tests/t-reftable-tree.c | 59 +++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 63 deletions(-) delete mode 100644 reftable/tree_test.c create mode 100644 t/unit-tests/t-reftable-tree.c diff --git a/Makefile b/Makefile index d6479092a0..6f423a2a1e 100644 --- a/Makefile +++ b/Makefile @@ -1341,6 +1341,7 @@ UNIT_TEST_PROGRAMS += t-oidtree UNIT_TEST_PROGRAMS += t-prio-queue UNIT_TEST_PROGRAMS += t-reftable-basics UNIT_TEST_PROGRAMS += t-reftable-record +UNIT_TEST_PROGRAMS += t-reftable-tree UNIT_TEST_PROGRAMS += t-strbuf UNIT_TEST_PROGRAMS += t-strcmp-offset UNIT_TEST_PROGRAMS += t-strvec @@ -2685,7 +2686,6 @@ REFTABLE_TEST_OBJS += reftable/pq_test.o REFTABLE_TEST_OBJS += reftable/readwrite_test.o REFTABLE_TEST_OBJS += reftable/stack_test.o REFTABLE_TEST_OBJS += reftable/test_framework.o -REFTABLE_TEST_OBJS += reftable/tree_test.o TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS)) diff --git a/reftable/reftable-tests.h b/reftable/reftable-tests.h index 114cc3d053..d0abcc51e2 100644 --- a/reftable/reftable-tests.h +++ b/reftable/reftable-tests.h @@ -16,7 +16,6 @@ int pq_test_main(int argc, const char **argv); int record_test_main(int argc, const char **argv); int readwrite_test_main(int argc, const char **argv); int stack_test_main(int argc, const char **argv); -int tree_test_main(int argc, const char **argv); int reftable_dump_main(int argc, char *const *argv); #endif diff --git a/reftable/tree_test.c b/reftable/tree_test.c deleted file mode 100644 index 6961a657ad..0000000000 --- a/reftable/tree_test.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 2020 Google LLC - -Use of this source code is governed by a BSD-style -license that can be found in the LICENSE file or at -https://developers.google.com/open-source/licenses/bsd -*/ - -#include "system.h" -#include "tree.h" - -#include "test_framework.h" -#include "reftable-tests.h" - -static int test_compare(const void *a, const void *b) -{ - return (char *)a - (char *)b; -} - -struct curry { - void *last; -}; - -static void check_increasing(void *arg, void *key) -{ - struct curry *c = arg; - if (c->last) { - EXPECT(test_compare(c->last, key) < 0); - } - c->last = key; -} - -static void test_tree(void) -{ - struct tree_node *root = NULL; - - void *values[11] = { NULL }; - struct tree_node *nodes[11] = { NULL }; - int i = 1; - struct curry c = { NULL }; - do { - nodes[i] = tree_search(values + i, &root, &test_compare, 1); - i = (i * 7) % 11; - } while (i != 1); - - for (i = 1; i < ARRAY_SIZE(nodes); i++) { - EXPECT(values + i == nodes[i]->key); - EXPECT(nodes[i] == - tree_search(values + i, &root, &test_compare, 0)); - } - - infix_walk(root, check_increasing, &c); - tree_free(root); -} - -int tree_test_main(int argc, const char *argv[]) -{ - RUN_TEST(test_tree); - return 0; -} diff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c index aa6538a8da..8c41ef7c9d 100644 --- a/t/helper/test-reftable.c +++ b/t/helper/test-reftable.c @@ -6,7 +6,6 @@ int cmd__reftable(int argc, const char **argv) { /* test from simple to complex. */ block_test_main(argc, argv); - tree_test_main(argc, argv); pq_test_main(argc, argv); readwrite_test_main(argc, argv); merged_test_main(argc, argv); diff --git a/t/unit-tests/t-reftable-tree.c b/t/unit-tests/t-reftable-tree.c new file mode 100644 index 0000000000..08f1873ad3 --- /dev/null +++ b/t/unit-tests/t-reftable-tree.c @@ -0,0 +1,59 @@ +/* +Copyright 2020 Google LLC + +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file or at +https://developers.google.com/open-source/licenses/bsd +*/ + +#include "test-lib.h" +#include "reftable/tree.h" + +static int t_compare(const void *a, const void *b) +{ + return (char *)a - (char *)b; +} + +struct curry { + void *last; +}; + +static void check_increasing(void *arg, void *key) +{ + struct curry *c = arg; + if (c->last) + check_int(t_compare(c->last, key), <, 0); + c->last = key; +} + +static void t_tree(void) +{ + struct tree_node *root = NULL; + void *values[11] = { 0 }; + struct tree_node *nodes[11] = { 0 }; + size_t i = 1; + struct curry c = { 0 }; + + /* pseudo-randomly insert the pointers for elements between + * values[1] and values[10] (included) in the tree. + */ + do { + nodes[i] = tree_search(&values[i], &root, &t_compare, 1); + i = (i * 7) % 11; + } while (i != 1); + + for (i = 1; i < ARRAY_SIZE(nodes); i++) { + check_pointer_eq(&values[i], nodes[i]->key); + check_pointer_eq(nodes[i], tree_search(&values[i], &root, &t_compare, 0)); + } + + infix_walk(root, check_increasing, &c); + tree_free(root); +} + +int cmd_main(int argc, const char *argv[]) +{ + TEST(t_tree(), "tree_search and infix_walk work"); + + return test_done(); +} From patchwork Mon Jul 22 05:57:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Pratap X-Patchwork-Id: 13738321 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 762891805A for ; Mon, 22 Jul 2024 06:19:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721629188; cv=none; b=rb5FUkRrAQrVxaMSNcDtbEfbxuKl72spch6tlo5mXFkz06t3rf4urP32caU5iEefM9rPJ8f8ghlkUGGipdiy9GHc9Kdnf9f9BHdY6mg3GqiYZ/AMgVokg9IRXW9ITYX9+N4IUQAjLZ5z8JzMlHS0ewUqCbjwU+02XOjttyiXXcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721629188; c=relaxed/simple; bh=fStEPHID7xWFZ60pLbk+mQYRMmUDALwefONhmqcufPQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MQusJnmoYG4LVS1FXIs/idVhuToX01URzfv/eT0OZzoNhphklrOoDPqL6of1ZzPQ118wH4EEIN36e5/uPyQx4Bsttc8JlqLJHbp7uOe1LmiDj4bo7MzEWsa2wF43lxx3bc3r8y5ujNVfGmz6x62dyHEi/qAU3hKipHi04UPPQyc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fYEjkZZw; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fYEjkZZw" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1fd78c165eeso13428495ad.2 for ; Sun, 21 Jul 2024 23:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721629186; x=1722233986; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aTl0pqmzGK8MaW59+NZjF70fraW3oqa4jEe3gPNb+4k=; b=fYEjkZZwk/Y5QSRjvcV+fbsp5mxpoFOV7BPqPlzqQfrGIHr65GY1DJq2OOwnVPc3DY +P+JFPTvS+/8Ah5LVH9eA4lV/Dit9uiNeY9LpkBQk8Z3EzKgu3h/iKc+6O9DBImIzbUB sCzzIZBT1nxy1zMN01VV99BB7kDxcNeviZyHzViMGUU5QSap2dKNXDouwg2Rs5berDFO ifoDkD2Fams8n6Y5prJGT0/2enc3uCiPVv6U3SECao17jbnY9JcMWxZzj1SbHHSwRu1N a2Mo/iwBLBTrFrTYucn2xpwL8Jm5Q1riQW/mK9YhFY8kDqGLyREzfwBMkxsZtWn7Lsuy /z/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721629186; x=1722233986; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aTl0pqmzGK8MaW59+NZjF70fraW3oqa4jEe3gPNb+4k=; b=O7X29vgOu5QsVFcBJB8p2HqrTEZD6Pkw5BCr8LN//ZTyQqD6vdvlut1VOOijRYfAd5 V/eeW306cb/UrHfkT5Rs96c1sWU3sicvT8r+SvUPL+1IxLvaG5Azt+lyDt4XGnAZjcwk oyu6OeWtCBlg+cIyUgvVIQQxbQtwxJEnqVoGPgvHzjz8NAkoNuyWgUILp1D+PfnRRK5d fOp4GGfffZI1E3msEv8+L44fvnRGwhHt5iRVt/VOWMj69CRpK/2drSKYEWzYHSA0QkaD Acb9DBSA/10k6+1pfi6RkwpX+e8oKKObJsI4ridR6VYynvCg9Dk41yvgIDZM124wP/wG 5lIQ== X-Gm-Message-State: AOJu0YyxEosshtJucnc2Wsq4XA5ppcdHxi3gZrqsi+wGDXk4hm8neDn3 eIbP4upgkNnpZ7oElYjeSWJ9LVqgUo0fq5aSWBX+oIs4xhULVZXI2xuHbIU0Tm8= X-Google-Smtp-Source: AGHT+IHI4tNTDqFJEka2Zs4mGMnOJKVnVL1DA34S8o/dxnTcLw8k8i8W7PMfDmEC2tCGRKiQt6nP2g== X-Received: by 2002:a17:902:f68d:b0:1fc:2ee3:d46f with SMTP id d9443c01a7336-1fd7451535amr51801435ad.11.1721629186298; Sun, 21 Jul 2024 23:19:46 -0700 (PDT) Received: from Ubuntu.. ([106.220.63.154]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-1fd6f31a73csm46362885ad.143.2024.07.21.23.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jul 2024 23:19:45 -0700 (PDT) From: Chandra Pratap To: git@vger.kernel.org Cc: karthik188@gmail.com, chriscool@tuxfamily.org Subject: [PATCH v5 3/5] t-reftable-tree: split test_tree() into two sub-test functions Date: Mon, 22 Jul 2024 11:27:56 +0530 Message-ID: <20240722061836.4176-4-chandrapratap3519@gmail.com> X-Mailer: git-send-email 2.45.GIT In-Reply-To: <20240722061836.4176-1-chandrapratap3519@gmail.com> References: <20240716075641.4264-1-chandrapratap3519@gmail.com> <20240722061836.4176-1-chandrapratap3519@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In the current testing setup, tests for both tree_search() and infix_walk() defined by reftable/tree.{c, h} are performed by a single test function, test_tree(). Split tree_test() into test_tree_search() and test_infix_walk() responsible for independently testing tree_search() and infix_walk() respectively. This improves the overall readability of the test file as well as simplifies debugging. Note that the last parameter in the tree_search() functiom is 'int insert' which when set, inserts the key if it is not found in the tree. Otherwise, the function returns NULL for such cases. While at it, use 'func' to pass function pointers and not '&func'. Mentored-by: Patrick Steinhardt Mentored-by: Christian Couder Signed-off-by: Chandra Pratap --- t/unit-tests/t-reftable-tree.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/t/unit-tests/t-reftable-tree.c b/t/unit-tests/t-reftable-tree.c index 08f1873ad3..07c6c6dce5 100644 --- a/t/unit-tests/t-reftable-tree.c +++ b/t/unit-tests/t-reftable-tree.c @@ -26,13 +26,12 @@ static void check_increasing(void *arg, void *key) c->last = key; } -static void t_tree(void) +static void t_tree_search(void) { struct tree_node *root = NULL; void *values[11] = { 0 }; struct tree_node *nodes[11] = { 0 }; size_t i = 1; - struct curry c = { 0 }; /* pseudo-randomly insert the pointers for elements between * values[1] and values[10] (included) in the tree. @@ -47,13 +46,29 @@ static void t_tree(void) check_pointer_eq(nodes[i], tree_search(&values[i], &root, &t_compare, 0)); } - infix_walk(root, check_increasing, &c); + tree_free(root); +} + +static void t_infix_walk(void) +{ + struct tree_node *root = NULL; + void *values[11] = { 0 }; + struct curry c = { 0 }; + size_t i = 1; + + do { + tree_search(&values[i], &root, t_compare, 1); + i = (i * 7) % 11; + } while (i != 1); + + infix_walk(root, &check_increasing, &c); tree_free(root); } int cmd_main(int argc, const char *argv[]) { - TEST(t_tree(), "tree_search and infix_walk work"); + TEST(t_tree_search(), "tree_search works"); + TEST(t_infix_walk(), "infix_walk works"); return test_done(); } From patchwork Mon Jul 22 05:57:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Pratap X-Patchwork-Id: 13738322 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A412F18AF9 for ; Mon, 22 Jul 2024 06:19:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721629191; cv=none; b=rMRTKrtW4hD6yY0pZK+NP/yapc8iX1Wu5g6jH02UMfPQkwI2sWDdFiVBaFSTPPV92Br8JkH7DyBSHsQL68I+W40ivCuwEN22QxuIjmJvr+Lh/j12IflHOb6z1n9+4lwzvPI+QFJqr3GUyWF/izxG3SPwyJnELh8tg9PR90p0HdM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721629191; c=relaxed/simple; bh=usfSD7IjlLiLtR/rVwdWNzfZ76N/u78FuvcZHoxoyz4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sw+TQnj2WY70NgMwqOCCqdzPaLI/S6d3Qsv3tQZ2TJYdEt9eKylF16cJq2t9mpO/fQKNmD13HdyiYtN40Svw8NI1vwXB5iPgrJSLOFYh1X5A3juLnxTFosrxAOtVtMaH8YZh2lGRvZmWauDGL+XMH/H9rTJIMPrGDzhOZ5idHoI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=a0Eudrci; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a0Eudrci" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-7a1215dd114so831317a12.1 for ; Sun, 21 Jul 2024 23:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721629189; x=1722233989; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uby8YAjXbOwtPujs+EUEgvHqkRO2jGGiEsAdlalx9go=; b=a0EudrcizDUPkgTd5+/lAff7vEEUr9smR8t9NaAqli/3Rp2RzeQOD9ra3m0BYanSYp B49Q29DZmj4oW81NHtVDZIMlgoK4ZRefiAeg6djJGHgeB8ehvFNhE6+5uQ8cdBX8dw5I OWYdJfD41/USnTqHZlHUQrRWmL+iP9uvfdgCYzCzsCAtDXZcIwAorMnZPq20Gi4gMDTZ 2LSlTQduNGt9B8f6kXixFMgDKWIONp8G1jmYaDxfFLLAYXimH1uZGIgi2hwrSrxPQUXO QaSlHgRKKnEsWutrVlRlNTLKwuRI1CX3W2Quop4BJAS+pQAC6O1KLQ8/ULBx5tlHNGjp bJPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721629189; x=1722233989; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uby8YAjXbOwtPujs+EUEgvHqkRO2jGGiEsAdlalx9go=; b=pnddlnd8Ewi0o9vU7kWirYoW0zybE+OMgnEEQ9TfCjYcBy5JkwNdKlpIfbrP4ZfJF2 rF9Rys/lwqQMxtnzAOSPDKJDklNK5YOkpwN5CuCpDiAQW3ZXww3yAw0lKXY4nCz4SvXU 2yWwBTY5HCii+Av2rYbrilAaA4xFxpdhVZl5NT/d2YLsP7NJluANm4DjdVJK295ddWvk WRk79s+zgnlJiu+55oFcrBXa1SK2lteKfR09QFuq6UPoejmsE7mq1VMBi0up58mqMbRs OGZqRuczHVKYg3lLAbjo++zQolshyf9JD/b2xSV7L+NBnDiaV+jzKXbd0WJEzM7TjKqR 2zdg== X-Gm-Message-State: AOJu0YyKw2VxMKPI7vRpzYoWEr89zql4DcLEDBuFYS1k8Q4uCZWjt0uG Ti34K+zXM9tnDzz4B//Eto5HXWgCnGyyEnXusByzCEmX1K6kRX/q5niwv8wC4Ag= X-Google-Smtp-Source: AGHT+IFIntBUEibwmCWqKVraooyGw14p3QpP1m4FC7wA+juUgjPnokjJpdLqJUhSo0tI/2tN2RXMRg== X-Received: by 2002:a05:6a21:99a3:b0:1c0:f759:9544 with SMTP id adf61e73a8af0-1c422847decmr10046702637.11.1721629188681; Sun, 21 Jul 2024 23:19:48 -0700 (PDT) Received: from Ubuntu.. ([106.220.63.154]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-1fd6f31a73csm46362885ad.143.2024.07.21.23.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jul 2024 23:19:48 -0700 (PDT) From: Chandra Pratap To: git@vger.kernel.org Cc: karthik188@gmail.com, chriscool@tuxfamily.org Subject: [PATCH v5 4/5] t-reftable-tree: add test for non-existent key Date: Mon, 22 Jul 2024 11:27:57 +0530 Message-ID: <20240722061836.4176-5-chandrapratap3519@gmail.com> X-Mailer: git-send-email 2.45.GIT In-Reply-To: <20240722061836.4176-1-chandrapratap3519@gmail.com> References: <20240716075641.4264-1-chandrapratap3519@gmail.com> <20240722061836.4176-1-chandrapratap3519@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In the current testing setup for tree_search(), the case for non-existent key is not exercised. Improve this by adding a test-case for the same. Mentored-by: Patrick Steinhardt Mentored-by: Christian Couder Signed-off-by: Chandra Pratap --- t/unit-tests/t-reftable-tree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/t/unit-tests/t-reftable-tree.c b/t/unit-tests/t-reftable-tree.c index 07c6c6dce5..6cd35b0ea0 100644 --- a/t/unit-tests/t-reftable-tree.c +++ b/t/unit-tests/t-reftable-tree.c @@ -46,6 +46,7 @@ static void t_tree_search(void) check_pointer_eq(nodes[i], tree_search(&values[i], &root, &t_compare, 0)); } + check(!tree_search(values, &root, t_compare, 0)); tree_free(root); } From patchwork Mon Jul 22 05:57:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Pratap X-Patchwork-Id: 13738323 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46F17199B8 for ; Mon, 22 Jul 2024 06:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721629193; cv=none; b=CjgPF9WTigCAMvW1b3ODcm60PZGjCLo9qDFhDuZoVREdv86mSxtEZ8TaOGKqxzM4D10+YdT35mgDarbOjjtRjFS0/d+GzU0QHpoKqLvcYSLRXi57k5Qd+MQ00Q+zhdLKhtadP3+CNr9quwiOlHk2e4iD+FHi4XRPtMHdUgHAqtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721629193; c=relaxed/simple; bh=oK7G4tie52Mf2Ja8/jfPrZ3dZXGRCiAqu5vkLd7QnMs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ig6+zrA73cZz/bTw3F9Xi+cuWamGOYqdeoxDSlqslYJS2qsbExiMRAwIAoSrg8qsmDyDuvtDmc89lsdjXtcL0AP9KKkAq6ibygNWTpsskQMYnyUxGKm1GkaP1vOF1ASux9hFjqzmzdzAXvYAQ3/L19//gvvuwAqHKmsSBtIGGCc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GF7qyV+K; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GF7qyV+K" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-70d333d5890so85449b3a.0 for ; Sun, 21 Jul 2024 23:19:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721629191; x=1722233991; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=etwOXNaKfnUlohRB/w327d+jKqCAx6BI8Yc8u2vmvzo=; b=GF7qyV+K1FWbHlPbqvj/6JIgZu2yNsF8mszc3PAPydyZzNETW3rfgMwrq0wzx7FnVX iBM+kADkGxfvo7ddsxURsNFmZWTf4OrH260FkpNnH/kvvsKOrbLgcdqQTe90ZlKL1nIB UYfmeFsLTKttZV484lHyWAvlyVvhYZ5P+s5BuSNTV1U6u1B3iX9Z2zp0k/BAeRI4LuxD WTAQDjS00Qu82BUYW60zEZEbVNBsY6iD+mFNsOoCFxOwBolZlqrQS6oxJ+Kym+Dcxyjt aN5sU3YS0FsGmCBUi2tcXJFMCboXvfK4B4e8sReJ5SadUjOmmsZd5PWrrEtWq+0kXuYe GdsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721629191; x=1722233991; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=etwOXNaKfnUlohRB/w327d+jKqCAx6BI8Yc8u2vmvzo=; b=QIr9Y9OZznlAW8f4RF+9mHQ5yMhSsdUxAkY5aKWsp6eiFwSzKMMpJm79Ogygw0kMec zIAYp2C6DlFG/gtWL/xrC2rjnTWVn1Jo9AJhhptcQUIq9mds7RJEUTkPBAjyKzouE9Jz QQAi/6U6E1IVGVdEHvXlA4GwJbdYWWreuOJKhpX0/SviSMLdbNdZuwBjCNKeTApR+nRd bHMOvD6EW0ZIC2WvW0qfmoH2Z9XCXxfwk+3/U9n5i/62lW7zO5ZBcANtIG2l3XdUjb0c IFS0Rtew2fwSleKautZH3FcKzGPYLYpmLm5C0A2RP9tl8IC4ET+qldEacBvWImq2BOQz NfQw== X-Gm-Message-State: AOJu0YwX7WEIQVEib/nECChyjaY5ZhwUt4hJqidMxEBptOkeb0F+diJx F6tdd+OeLGd2WtFsXj3sFHlsrmq4TCdnTucHlPgSDF5Wqqu/EnZofUAT4WEtvtM= X-Google-Smtp-Source: AGHT+IE+6tPuDEWInY/OYyBorpE2tLXZO4qa4UOT6CwkOpEAH8w9M6YPxxSGhbiPc3tw9wJEuxLrLQ== X-Received: by 2002:a05:6a21:e93:b0:1bd:24f9:1124 with SMTP id adf61e73a8af0-1c4228c3782mr9575008637.27.1721629191100; Sun, 21 Jul 2024 23:19:51 -0700 (PDT) Received: from Ubuntu.. ([106.220.63.154]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-1fd6f31a73csm46362885ad.143.2024.07.21.23.19.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jul 2024 23:19:50 -0700 (PDT) From: Chandra Pratap To: git@vger.kernel.org Cc: karthik188@gmail.com, chriscool@tuxfamily.org Subject: [PATCH v5 5/5] t-reftable-tree: improve the test for infix_walk() Date: Mon, 22 Jul 2024 11:27:58 +0530 Message-ID: <20240722061836.4176-6-chandrapratap3519@gmail.com> X-Mailer: git-send-email 2.45.GIT In-Reply-To: <20240722061836.4176-1-chandrapratap3519@gmail.com> References: <20240716075641.4264-1-chandrapratap3519@gmail.com> <20240722061836.4176-1-chandrapratap3519@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In the current testing setup for infix_walk(), the following properties of an infix traversal of a tree remain untested: - every node of the tree must be visited - every node must be visited exactly once In fact, only the property 'traversal in increasing order' is tested. Modify test_infix_walk() to check for all the properties above. This can be achieved by storing the nodes' keys linearly, in a nullified buffer, as we visit them and then checking the input keys against this buffer in increasing order. By checking that the element just after the last input key is 'NULL' in the output buffer, we ensure that every node is traversed exactly once. Mentored-by: Patrick Steinhardt Mentored-by: Christian Couder Signed-off-by: Chandra Pratap --- t/unit-tests/t-reftable-tree.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/t/unit-tests/t-reftable-tree.c b/t/unit-tests/t-reftable-tree.c index 6cd35b0ea0..d7d530f2f7 100644 --- a/t/unit-tests/t-reftable-tree.c +++ b/t/unit-tests/t-reftable-tree.c @@ -15,15 +15,14 @@ static int t_compare(const void *a, const void *b) } struct curry { - void *last; + void **arr; + size_t len; }; -static void check_increasing(void *arg, void *key) +static void store(void *arg, void *key) { struct curry *c = arg; - if (c->last) - check_int(t_compare(c->last, key), <, 0); - c->last = key; + c->arr[c->len++] = key; } static void t_tree_search(void) @@ -54,15 +53,24 @@ static void t_infix_walk(void) { struct tree_node *root = NULL; void *values[11] = { 0 }; - struct curry c = { 0 }; + void *out[11] = { 0 }; + struct curry c = { + .arr = (void **) &out, + }; size_t i = 1; + size_t count = 0; do { tree_search(&values[i], &root, t_compare, 1); i = (i * 7) % 11; + count++; } while (i != 1); - infix_walk(root, &check_increasing, &c); + infix_walk(root, &store, &c); + for (i = 1; i < ARRAY_SIZE(values); i++) + check_pointer_eq(&values[i], out[i - 1]); + check(!out[i - 1]); + check_int(c.len, ==, count); tree_free(root); }