From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 1B6606EC59; Wed, 10 Mar 2021 13:26:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1B6606EC59 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1615371970; bh=JXKezpta4yb4Q2sFTkD/QysF0mAJ+4KKWOFFIp8cO+k=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=hkziVc7gHYMne4ZbBTLkBOmq9qZ8ONHRBkev6sP9OKcCQfNOWJzSXJMMqQrfims9L rOfFRdRs9ZDQseqWSSxCLWeJkR//FoUzYgktNKgMqf/dp15X5h5wg1nZzlct8Juiih UTuE/67RmDztkDg97/H+nxvyR5wZkA1PA7E1f1/I= Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 353946EC59 for ; Wed, 10 Mar 2021 13:26:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 353946EC59 Received: by smtp63.i.mail.ru with esmtpa (envelope-from ) id 1lJw2Z-0000C7-Qa; Wed, 10 Mar 2021 13:26:08 +0300 To: Kirill Yukhin , Cyrill Gorcunov Date: Wed, 10 Mar 2021 13:25:19 +0300 Message-Id: <20210310102519.18720-1-skaplun@tarantool.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9D3134714A9BDB69BE66984610072BB1D09A72A4B5C8F966400894C459B0CD1B9319ADBB70613814A100E225E40D3EA4C76D915FD6FA35600EFDB812A93E8900B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7ACA11F7F2395C8CCEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637593B4F2A76947A308638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C1F4A82545730C761FC942C9B1B5244B8F8B9A72C3C99CC2EA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3E97D2AE7161E217F117882F4460429728AD0CFFFB425014E868A13BD56FB6657A7F4EDE966BC389F9E8FC8737B5C2249AC294AFEFA671E80089D37D7C0E48F6CCF19DD082D7633A0E7DDDDC251EA7DABAAAE862A0553A39223F8577A6DFFEA7C0BF7CEC3D2FC0D9C43847C11F186F3C5E7DDDDC251EA7DABCC89B49CDF41148FA8EF81845B15A4842623479134186CDE6BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C1F4A82545730C761FC942C9B1B5244B8F8B9A72C3C99CC2E9C2B6934AE262D3EE7EAB7254005DCED96AFF475DEAA52261E0A4E2319210D9B64D260DF9561598F01A9E91200F654B0CCA28C6D779E2CD78E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3419891600CCEF46079245A273B0659FF08D9FCF3401FBAD7E1ADCCF7D79A011AC048F889B187B54621D7E09C32AA3244C21F768F42BE75FC4EBDAE2E1F58B3A03E3D93501275E802F927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojsR8tyFmO15P+Hedb6dn5HQ== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB4E9F254D8113847471ECF01849FA74DE4E977021A3E2975FBF2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: [Tarantool-patches] [PATCH] test: full testing of guava golden100 array X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" golden100 is an array of int32_t elements. So sizeof(uint64_t) is exactly double array element size. In other words, only half of golden100 array is checked. This patch makes calculation of array size type-independed. --- Branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-noticket-golden100-test-fix Example to demonstrate the old behaviour: | $ gcc -x c <(echo -e "#include | int main(void) { | int32_t g[] = {0, 55}; | uint64_t nr_elems = sizeof(g) / sizeof(uint64_t); | return nr_elems; | } | ") -o /tmp/test.exe && /tmp/test.exe || echo $? | 1 The new behaviour: | $ gcc -x c <(echo -e "#include | int main(void) { | int32_t g[] = {0, 55}; | uint64_t nr_elems = sizeof(g) / sizeof(g[0]); | return nr_elems; | } | ") -o /tmp/test.exe && /tmp/test.exe || echo $? | 2 test/unit/guava.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/guava.c b/test/unit/guava.c index fd496af9e..234d3627f 100644 --- a/test/unit/guava.c +++ b/test/unit/guava.c @@ -46,7 +46,7 @@ lcg_compat_check() 0, 55, 62, 8, 45, 59, 86, 97, 82, 59, 73, 37, 17, 56, 86, 21, 90, 37, 38, 83 }; - uint64_t nr_elems = (uint64_t)sizeof(golden100) / sizeof(uint64_t); + size_t nr_elems = sizeof(golden100) / sizeof(golden100[0]); for (size_t i = 0; i < nr_elems; ++i) check_guava_correctness(golden100[i]); -- 2.28.0