From patchwork Fri Aug 2 12:08:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Pratap X-Patchwork-Id: 13751509 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 AD3221E2892 for ; Fri, 2 Aug 2024 12:14:29 +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=1722600871; cv=none; b=XrnTU9Kx4SlZ1/wdYKQ85LcmBwR0FKKhTtrFdYR2IivPe/+ajO8R+X1SpLitI6raGTj5KH9dc0gRKFiT6bUtEgNgSF6BJoy7hmDRJJWeikrOPHK8yW9UgJjJrsfUpsDO2SXuOwvCzQLhSdRd7eX/p8DtQQZxSFgXUvFrlff1Qco= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722600871; c=relaxed/simple; bh=6dcZwXz7GFp7iAldfAYFiGDg1AfVonu0hu3Z6u9wQN4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LYjs+4di6p3hmOv9EAJtJs7jeoB1LlEhA7c7HGvgpZrpVlBLriSiI6LePAVgbXui0sAocuwPLNwFDFpzQ3NHhYs9qJ09OF8zxYo6Z4tnyD5qYCKAc2LG4/kx5zs0KT1N4KUhB8jkbUBoppyH3jPDSFBJLFz37iTSNQEnBDgQ2Cs= 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=eg8cb0As; 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="eg8cb0As" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7104f939aa7so2557817b3a.1 for ; Fri, 02 Aug 2024 05:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722600869; x=1723205669; 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=eg8cb0Asmv9A/gWiIPton7s79PyBEB6Ht3DmObD6otkEmZ/H2GyVZYihh8y3hdOg0C +7BgJ9MRkBf1+5tTeds6D0QX9twchzgqLbwDIl09QZ5ee8RjKV6wwfeYmuA3EDiwlz9o S6TkWdMcmdxDhXRv5KLrjMITi4+5AkYDOtoqjn7fL7OVRge2LPtu8UBhplHfLMGlEO7N PmbDrVnMHEhzZF8bWFrBi00bNya4d4gY5XG78gNU65xyXpVCcVdQerLxAtKk+j0hmmp9 pGI0s2C9DVXfyGe2bN6DoUtmP/cvBs9Mmgb1MWsPUgdaUOu0/dgpVc7sgYpiH35AeOAN JSBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722600869; x=1723205669; 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=JhUKRlF922ABLEEpmx9h1l8KP43g/zGrGahaz3yvYv0g1mSE8H7aOs5+vc7nuVTNhy 7qz3lTKDn28sQsgfQR2WZ4tmczh3vigiivHtbdM6XL1AS32Y/8BGl86fssd6uqxCkqhL Peeqj+AGBBCEhWXyUiuQvcqefvBVLZiZl5jqUsyY9SfCYwNp1LN0KFJ4noZoEpLcy7JP TAA9PRDfUdLKlqn1J/CpBbYVpfbm8igyj1G4lmmVhr/Xx6vFUAZt2F5YwHPoRh+Tpvs2 FWiHuwRcZ0BxWYm68MBGgWUQKg4zkMhJ6kB95tyfOaK2B9xCv0clX0Mdf2swVQV6Uh9m Kb9g== X-Gm-Message-State: AOJu0YzQui8aq5yTzxFwy1gbVUywOWxyJmL32jOOmtztRr7Adgzxy4y/ mD38JJxzwhI8zk9mv7ajT/dBiaHSOwL+9FlTexSTRt6HQbTKAvXzVT7U+w== X-Google-Smtp-Source: AGHT+IGlPaHoPXVtHAB0XZqTIy411povLM0QEepbSII1dt3tA+Nl+Tg4D5ao20eOAkoQTr+oLBEs8w== X-Received: by 2002:a05:6a20:9f86:b0:1be:e1e1:d5de with SMTP id adf61e73a8af0-1c6995ab96fmr4170449637.30.1722600868309; Fri, 02 Aug 2024 05:14:28 -0700 (PDT) Received: from Ubuntu.. ([106.213.168.25]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-7106ec16034sm1294534b3a.15.2024.08.02.05.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 05:14:27 -0700 (PDT) From: Chandra Pratap To: git@vger.kernel.org Cc: Chandra Pratap , Patrick Steinhardt , Christian Couder Subject: [PATCH v6 1/5] reftable: remove unnecessary curly braces in reftable/tree.c Date: Fri, 2 Aug 2024 17:38:04 +0530 Message-ID: <20240802121318.4583-2-chandrapratap3519@gmail.com> X-Mailer: git-send-email 2.45.GIT In-Reply-To: <20240802121318.4583-1-chandrapratap3519@gmail.com> References: <20240722061836.4176-1-chandrapratap3519@gmail.com> <20240802121318.4583-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 Fri Aug 2 12:08:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Pratap X-Patchwork-Id: 13751510 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 6C47C1E3CA8 for ; Fri, 2 Aug 2024 12:14:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722600874; cv=none; b=jcukWji3RRhPC/q3qIMdBCqchfRDRitR1+QdHUlt9fRoYE72s4o/9GUheRF2uV6WOnUJlKSfMf6MumWVxQ9/E7jHHtESAfkxOTcQig896ydEQw2g7gXn4x3YuBKhe8hdrhP9dJP7NbeLWS+u1HJLSfwz0is+So6zPbGBYDH6+lQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722600874; c=relaxed/simple; bh=+22dSkfQbPJueRh80Q76V7X8FxQ8t5F5fTl3aG9z94k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mD4Ao3+vWe2QQFPEmdaxAyE7z40h6RLXFKeHP6GWuUFhF4oeDNOC6nxA7M+dc6+aPImd9pqOkGcJriJ6FP9gEXU/rfvNRaOaqgmEVzwrayJo/zXpWOurGTOH1nbCZS7F0zvZ9ZKWWtWcNmxyZuITagp+KNpUk598cEMj5NBoiq0= 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=L7KxI1po; arc=none smtp.client-ip=209.85.210.169 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="L7KxI1po" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-7106e2d0ec1so814029b3a.2 for ; Fri, 02 Aug 2024 05:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722600871; x=1723205671; 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=1ZA9nZQwqpO3hA3ae2hNED+3x7rama5TJT1JVO8u6Oc=; b=L7KxI1poGankDlhikcwfrQqOM6SXrJh4G6AWgvkxF2YBaxGlsF29bEfECrKydjn3Rn 6TdvztJdpxnZHjtV2aiC3OinlTp0Khy7EBqTw+YRloTfmPLOnTv6XYvOPctlPImyCs25 CNjXK/YjaKPWnZlwhs52WPbCeJe0/dcGeS+l4WhtAUBYrELcGSv17fi83hc6ADKLXnTS gt9V2hLxzeddsxs5VqjTBPJIQjwg9b4fngMMefrbdV5rGe/w49B+4I1Y2zwgn3KKqpK9 6577/k4Q1l/Bm6V0l9KOcy5T+GDCl5qARzgihqOrmSXJOKFPwc0wpjm/LyaIeaTAf8XI RGWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722600871; x=1723205671; 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=1ZA9nZQwqpO3hA3ae2hNED+3x7rama5TJT1JVO8u6Oc=; b=asVM47FBULBFEZC22PAI6RubUjDfvwcEIpVl/RYuvvf721LonsLE/iEbyY5NI+RCQ0 gHaSoSDZMkCZFBwtl23mS0oBqcXxxCd9MFwIn+umr96/R902NlmpGwzn0d4jr+arMcfV 2bgDh29QIbeygw1DKehXtwTKzXY9ZY4NIiPjHCgvyegSKC20116e1bTrx02FDDnoOsYm PTnfVkgXMuafFmePwskpa2SiP/jYrg5pLpNRHJqVVKxxxDyXGvCp7MT5f8/KdLA8n3Au uID0q0esQx4dVpfLnV+7CVAqUNhadNJHU0FfNBVERO1rzp/mZ+beAcspltONfzGeCcM4 CznQ== X-Gm-Message-State: AOJu0YyQQ+DDCQY59RT9G7PquuIgIlivWvSNdxAe9M32TL58jGhg2V/W 8yh/tihazBZIlzP/UHGDXWC/fhQvq8N+ony2KjC/79gbbpUWAiKp/XfKLw== X-Google-Smtp-Source: AGHT+IEfliex0IBfPUQ56M1jNey+jHBzkaBxsYe9F2mvoYGXKUfAUZ1UJ9FezzcaMno5/ikJYxVaMQ== X-Received: by 2002:a05:6a20:7346:b0:1c4:6be0:912f with SMTP id adf61e73a8af0-1c69953c712mr5037567637.10.1722600871138; Fri, 02 Aug 2024 05:14:31 -0700 (PDT) Received: from Ubuntu.. ([106.213.168.25]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-7106ec16034sm1294534b3a.15.2024.08.02.05.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 05:14:30 -0700 (PDT) From: Chandra Pratap To: git@vger.kernel.org Cc: Chandra Pratap , Patrick Steinhardt , Christian Couder Subject: [PATCH v6 2/5] t: move reftable/tree_test.c to the unit testing framework Date: Fri, 2 Aug 2024 17:38:05 +0530 Message-ID: <20240802121318.4583-3-chandrapratap3519@gmail.com> X-Mailer: git-send-email 2.45.GIT In-Reply-To: <20240802121318.4583-1-chandrapratap3519@gmail.com> References: <20240722061836.4176-1-chandrapratap3519@gmail.com> <20240802121318.4583-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 3863e60b66..5499f7bcbd 100644 --- a/Makefile +++ b/Makefile @@ -1342,6 +1342,7 @@ UNIT_TEST_PROGRAMS += t-prio-queue UNIT_TEST_PROGRAMS += t-reftable-basics UNIT_TEST_PROGRAMS += t-reftable-merged 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 d5e03dcc1b..8516b1f923 100644 --- a/reftable/reftable-tests.h +++ b/reftable/reftable-tests.h @@ -15,7 +15,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 9d378427da..0acaf85494 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); stack_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 Fri Aug 2 12:08:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Pratap X-Patchwork-Id: 13751511 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 65A581E3CAE for ; Fri, 2 Aug 2024 12:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722600876; cv=none; b=uWLrQCip3V1vBWYy8EijXJgf9QyQRjxuM2TaP2RGM5MEGklqw3nh3nzqDX+6JvrOnGyZ4CHQaSvN1Buke+5ekRNWycA1cG/9S7Bz84h5qneQUQEoqejqh87lQbkb7h6MBNOai68OAZWuq39DXBJeuxS65jYmpZfOHGnoCZctVnE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722600876; c=relaxed/simple; bh=buQm7Sc9GzCvvG7QsgAQgd1LOKkOrctLPFh6uzuuO8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=huEFUfTgQss4osDGSq9gLMtwTT+ZKdUMbx+f5KVoA+aV3KPl5D4bwXKAHnLwqfEUUlCzd8go7gyKmW9uIs38UctGcKf8wYT114sZo4NHkh2mo4i3enfS7mlIdZwBOM6A809sOfjaBp8uNdS8ERt1S+yfV2fXVlwChY2Oq1rjZno= 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=WL0aAt3A; arc=none smtp.client-ip=209.85.210.169 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="WL0aAt3A" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-7104f939aaaso2527605b3a.1 for ; Fri, 02 Aug 2024 05:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722600874; x=1723205674; 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=t/UxxA4EGpStxMUWOVlz1KPcsKx8pXFlEu4F7KDbbIw=; b=WL0aAt3ACk10pgOmyJonE0DOH0MHTDhwBvpCXtTY7PK5pkK4Z6rGTWjTkEgAiaSzjN 3cPtYpVvWrhGFjUKIstUBmo2zBu6njNRx35FMIl/itynxKB8w1SWUTwu+qQ0cemXEWhN QICqZ8eiNBVyrQH1hps2l/rRVVM9vHb4fOiGF9TwGL16RbHb9yYUkvDSxzYA6Bk3sidG rJCWiW9BE6K6zdVsHZmfILsNbUrvbkmhkGP3y90JyRk2pPVcAWHbnhhd0FgLzcZTO1te AJ7xdsZiB2tpFMB4IgZvAEsDW/kym7uykwvUkJqHo/8WHlQBsEv+XpWHqV99by5cnIMN rKfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722600874; x=1723205674; 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=t/UxxA4EGpStxMUWOVlz1KPcsKx8pXFlEu4F7KDbbIw=; b=F+cFKzYCkLy4gCqyzYjFhA/LLHAJLMqHW6BZY6zXqbLUdWsN6WL0ARUPPs/nWYWbQI ka+pX0ocIcOX9LmC9kKOWRW/17n7B7YxLmJh8tVOVpzEpXH4zq7oDaSI5ad+q7nkW5sL WyLwmFs/ODRGZ0+2cC4a8Tmytg/3+tU8+/+Fm8a8YuGbsrLM+kCV1ZJkvFuyJ4y70tQo nzZlVSsSqwRiaMrVN67W8S8DK24tjfUys2+Ogc//Wip79YmZxvScYpaZ/Fpg/IGLY42J SPT96vYPDd1LaHlf78g1z9ea3CsraHyDVz+cDW85fmrpyfkoAs/OhvQ0sMBSrwdeeJL/ 2GFw== X-Gm-Message-State: AOJu0YxwlvUbD1wpEb4xGFcE7xkC2eAbvR8EozkN0WtUldJeMAyrZYSK 3Q65Gryz8EiTge1cA6Ll9myegMyPo6vorQM6bloDxaDfnpKqN5VgSEsbcQ== X-Google-Smtp-Source: AGHT+IG0bHJlgrfTIoO6XAZ7KY7eSMQbCB8jBN6WfzzHqifVOXJSggDB8EEArqAxbWhhF/LavrjmNQ== X-Received: by 2002:a05:6a00:1891:b0:70e:98e2:fe3c with SMTP id d2e1a72fcca58-7106cf95394mr4884613b3a.2.1722600874105; Fri, 02 Aug 2024 05:14:34 -0700 (PDT) Received: from Ubuntu.. ([106.213.168.25]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-7106ec16034sm1294534b3a.15.2024.08.02.05.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 05:14:33 -0700 (PDT) From: Chandra Pratap To: git@vger.kernel.org Cc: Chandra Pratap , Patrick Steinhardt , Christian Couder Subject: [PATCH v6 3/5] t-reftable-tree: split test_tree() into two sub-test functions Date: Fri, 2 Aug 2024 17:38:06 +0530 Message-ID: <20240802121318.4583-4-chandrapratap3519@gmail.com> X-Mailer: git-send-email 2.45.GIT In-Reply-To: <20240802121318.4583-1-chandrapratap3519@gmail.com> References: <20240722061836.4176-1-chandrapratap3519@gmail.com> <20240802121318.4583-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 | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/t/unit-tests/t-reftable-tree.c b/t/unit-tests/t-reftable-tree.c index 08f1873ad3..5efe34835e 100644 --- a/t/unit-tests/t-reftable-tree.c +++ b/t/unit-tests/t-reftable-tree.c @@ -26,16 +26,15 @@ 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. + /* Pseudo-randomly insert the pointers for elements between + * values[1] and values[10] (inclusive) in the tree. */ do { nodes[i] = tree_search(&values[i], &root, &t_compare, 1); @@ -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 Fri Aug 2 12:08:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Pratap X-Patchwork-Id: 13751512 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 4E9BA1E2894 for ; Fri, 2 Aug 2024 12:14:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722600879; cv=none; b=OZ8kuJjmDppNw61e36ifIRAVB8Ts5Qg1E/ajVm+1qs5gU4RUyemBPKwxLaYvJS6DbjCsJfiE/IZcNL2yPtC0b3dmASkMS5W3tUXQ0vdftc2LIi0M6Se/eEmUMrLJ7Er1DKe0VAy3Ye8h1VOvdl81gXP8BsOG/GYoRN6zXzCweKI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722600879; c=relaxed/simple; bh=Lc46Y8U/wW96XQMyz3vl6CsjMo+P8vbnaHspBKzQ3I8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L+Eib+vH6BT0CcvWuTg3p4fd6pQ0spFxCCbPTURc6Yn/OxQTwzkvAmIyAMCV8Ay2TATc4U8byrPW0tJYss7qJ5w2EIGmcIzNSrzqX9kWn6Iyun3bzoSLCZA46ZdG5uhFoFX+ff1ABrEXZnoceJsincSIO/myVpWmCXZ4Tb711rg= 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=KxNv4bM4; arc=none smtp.client-ip=209.85.210.175 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="KxNv4bM4" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-70d1a74a43bso5981668b3a.1 for ; Fri, 02 Aug 2024 05:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722600877; x=1723205677; 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=xf8MrBUi738+95nFcX6h19aWln8Z6syjJXhu+jOLWJU=; b=KxNv4bM4E3C6kX5PYql9o43UWI0kyTtTDUeW7xm0URLjMyDRxiGfHmip8R9lfLaYDO e/b+dLYlKVUzCdADERMmWfnDPlR7II5z9ICzS79F0HpIwxqSMBIUp+t81oHieRNsU+3j l+Z33yL26pAmX0wufv8vyILKonY72vdP/0zpMnjX/j2KbRNkumUUosWU7yNbrbnFln+n qVDh14jfX9BDZT66LesZVQNLtu2pJTivjdM08BGJyRWCZ5MSb6z+ad+nICzRsadqYSKn g4+1JL4m1i/cb4ouOY7qFXPq84LxuYL/lqAsf8ktddRcXve72HSkb8u8Ysy9nEFlxlRi /3hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722600877; x=1723205677; 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=xf8MrBUi738+95nFcX6h19aWln8Z6syjJXhu+jOLWJU=; b=X/LHDuAl9T/2kDtfs1fhp9XIMO8kW+ZZQN/2G61QbvClhNr/FZiAtLP7KthhSe5zLw dlCYELLWrXCn2016L7u9mdUHj2PK/wPuifca0cXHFUpc14S1R4IyQzGg2+IrGD1eyZ8q QFq0g330IDdnRKeQEdSqTxesSqD8+g6OYH6Yia3C6Of8CJdiryIrA/pv1az8LWsSFMId G1u9i09RYP9FX71yzEVjsy4vPU+Ii4V8P3ok/yMT8hoNdJVd7EeUyIq+9Y1j804Obf0r FOX9a4U0fOA2YxOdV/vr+vYJZKR3DiFmlodujkzJHmOshlYWXaGtcfKA7WWRXDo02Car z+jA== X-Gm-Message-State: AOJu0YxXO74t+Lof48LdpMnryBaERWtW+z/+8AtgGMntjLK/e/l92w6v Gn9SSMRciag74UdnPJeVvUf4BZaW2HLolfFK9wjGZAz0sdhZs2EZhaAi7Q== X-Google-Smtp-Source: AGHT+IGM1ZuOVC6AAnBeSnlz1hq0Nc6oJGBxIUjYPH8d2eaAN697iWGBGUwvWNqFBmCAaxgsOlrRvQ== X-Received: by 2002:a05:6a00:66c8:b0:70e:8f89:7e29 with SMTP id d2e1a72fcca58-7106d043129mr3430751b3a.25.1722600877060; Fri, 02 Aug 2024 05:14:37 -0700 (PDT) Received: from Ubuntu.. ([106.213.168.25]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-7106ec16034sm1294534b3a.15.2024.08.02.05.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 05:14:36 -0700 (PDT) From: Chandra Pratap To: git@vger.kernel.org Cc: Chandra Pratap , Patrick Steinhardt , Christian Couder Subject: [PATCH v6 4/5] t-reftable-tree: add test for non-existent key Date: Fri, 2 Aug 2024 17:38:07 +0530 Message-ID: <20240802121318.4583-5-chandrapratap3519@gmail.com> X-Mailer: git-send-email 2.45.GIT In-Reply-To: <20240802121318.4583-1-chandrapratap3519@gmail.com> References: <20240722061836.4176-1-chandrapratap3519@gmail.com> <20240802121318.4583-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 5efe34835e..0f00a31819 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 Fri Aug 2 12:08:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Pratap X-Patchwork-Id: 13751513 Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) (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 70F731E2894 for ; Fri, 2 Aug 2024 12:14:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722600882; cv=none; b=mIa6Ern2oq6GhU6R1pEA7mRXiW2mI4oeWfYAbzPS/d3rCuR5TAXr/LTm/70CjyI7fX7cPYiAbNrR/wbZM2OeZq00h/rVxdK5wFqakcW2wJf0ENNmBvI44KMLVtYMgBstQlQU4oSg1c1XXuLU5p1N0xEykgXecG8RVetWQE9iMC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722600882; c=relaxed/simple; bh=rBLKAjtFxN8DKti51KQgMEWIp/RCSEInBpSItBXHs5A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZCbY3JcT2VlV7MvWybqGEf5YdG8aliPZ0xfuMi94JuZ2M0jnT+L4V8GySYdJl4pllRzgB03BZvrY+hkQsOqyDfOj9xyCSVsO72d+79tq15aIG1uJAw40LH2551cIFRWPUCX0CmAlIPSa4TcoelLbheAZOc2bQ6U1M9/966nUlCM= 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=PU3n0kIe; arc=none smtp.client-ip=209.85.160.42 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="PU3n0kIe" Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-250ca14422aso4829026fac.0 for ; Fri, 02 Aug 2024 05:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722600880; x=1723205680; 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=bx034VJcb6DVhEb+/mmsRZDQbDF35hOkLKmMRWrVtJc=; b=PU3n0kIehuoXTA4fPFbxTar6q+6ptGfCxv5deAlQAqKc4K1jPcePOXxSSH/IZPlC7k uSb9ZGTJsc1ZtVY8Ee4AY4YHBd1SvmFi/D66rE8YHnV2eSicVkkQjXFKQ+DI6BqrtDcs PgqxxSqPs7c4Svp2kGv+ZSJxqv1LkLmDONI5OPqj2jsYLKXm6Psj6L7QKNmgnbjWEEEL L7K+b2bIe/IvWWFOhP3gNzd6BqYKWIbacukS5mMSEpYJVW1zPs/G3U5Z0AbKiIHhsIGh LwqoY5nln7NaUWbPcev/ECxsaJJTLOrisace9KH98Q4B3qtHFm9/nwPYryWn3PtM7D2f JGVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722600880; x=1723205680; 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=bx034VJcb6DVhEb+/mmsRZDQbDF35hOkLKmMRWrVtJc=; b=v10/EM75TmriRPanP1ydoJJiejF3T6A1XGZAl/J9PYJ4YM4T51DR1lSOL4YCCQqQ9V 6ZGjqZ8I1cjAkhKAQiZgka0hPVF0VQ35TsqEUk9O+1PXg3ckvRlckleZZBQ7n+YOcmzg 6DcMaKcJuSgLfh3TsVm9imxk6r2oXciFrIJyA9noxylKgyEvLWMWJy4lt2yfaRBZEoxb clcA8Z1T99/X/B/UfYh/sleJOrRKgBgUFvFbPDfZxh0pb/C/eyjRBpAJ49NlmubU7Zbb F3p5rjJkf5Mp0TJayyA7kp1sr9MS/W8xrNMyKw8WL2ka6bZEBnWoka9W5eD2bOcHcCGs 1e2w== X-Gm-Message-State: AOJu0Yx+d8KDJ/BDXah+7wjFjCkSpPJUsCHGHFpsphHBokbdSup+y4kl 5JTP21NVQj3NrOL0FE86JOrb6cAZDKu2G4LZFjyTxTKsqjrfq0YeL+Nd7A== X-Google-Smtp-Source: AGHT+IEWV4ripFTxnBxNCXiSLtSNpeoy2HPP4Ec7bFMQibWCSb9+BQCcrYmldZiWrlAI0B8HBzl++A== X-Received: by 2002:a05:6871:14b:b0:25e:e6d:5247 with SMTP id 586e51a60fabf-26891b1ceb8mr4071392fac.14.1722600879978; Fri, 02 Aug 2024 05:14:39 -0700 (PDT) Received: from Ubuntu.. ([106.213.168.25]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-7106ec16034sm1294534b3a.15.2024.08.02.05.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 05:14:39 -0700 (PDT) From: Chandra Pratap To: git@vger.kernel.org Cc: Chandra Pratap , Patrick Steinhardt , Christian Couder Subject: [PATCH v6 5/5] t-reftable-tree: improve the test for infix_walk() Date: Fri, 2 Aug 2024 17:38:08 +0530 Message-ID: <20240802121318.4583-6-chandrapratap3519@gmail.com> X-Mailer: git-send-email 2.45.GIT In-Reply-To: <20240802121318.4583-1-chandrapratap3519@gmail.com> References: <20240722061836.4176-1-chandrapratap3519@gmail.com> <20240802121318.4583-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 0f00a31819..2fc6a34008 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); }