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 007FC69B6EB; Wed, 1 Nov 2023 11:29:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 007FC69B6EB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1698827389; bh=HiZxkWpb7dXQ0SlCHpJetOuZfTCPeFEAeyQDu7OrAQw=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=PhedGHvZJjEsrDb7FTMHedSSoENulAw7RVNXXxnQRQNxFlwQV/J/xgMftod+hUAcJ 8PPkv9jPlo7KsfaAJ5idloh41DwfBXg1MKBfYVekK4698QLKCy2DHXMYmTWNASjBo8 B6wbgBrJHZeeh41EHJTaAF9kxDoe2DTYVk3Di2/w= Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [95.163.41.79]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 48DBE69B6EB for ; Wed, 1 Nov 2023 11:29:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 48DBE69B6EB Received: by smtp38.i.mail.ru with esmtpa (envelope-from ) id 1qy6bi-00CNuJ-2y; Wed, 01 Nov 2023 11:29:47 +0300 Date: Wed, 1 Nov 2023 08:28:37 +0000 To: Sergey Kaplun Cc: Sergey Bronnikov , max.kokryashkin@gmail.com, tarantool-patches@dev.tarantool.org Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9C931D0C4A91E71307CBD599951FC17CC83BE0832B3B6A53700894C459B0CD1B9F8EF1DF6378693BB1D34821573F3C113696183D43DE5B4D303D3BFA7FB8E1556 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7C2204D4F9A221771EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006379428F6EA0D091379EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BE5CCB53A13BC8DBA16B0A6ABC824384EC2E486FF7E39DE11CC7F00164DA146DAFE8445B8C89999728AA50765F79006372A3B24BF85B2E607389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC821E93C0F2A571C7BF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947CF8BD4E506CFA3D88302FCEF25BFAB3454AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C3E06F720CA742837ABA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CFE97D2AE7161E217F1DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3EBF4D8D28E8B690335872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5BE48985397862EE0DAC052FB3A2776FE2E5E8D42E22D1635F87CCE6106E1FC07E67D4AC08A07B9B0F254576263B31EA9CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D34A5112A9AECFE11B1054B11F1BEC7B7D2285DB2C0C09A47EB3C2D572DABB702EB8D382AD4C12F2AEF1D7E09C32AA3244CAA394E486904EFB2100C504DE87A422FD08D48398F32B4A6BAD658CF5C8AB4025DA084F8E80FEBD376A4ED3E9341DC2FCD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojixD2AZzOsmNMDHe2/la4fA== X-Mailru-Sender: 2FEBA92C8E508479FE7B9A1DF348D5310A8F53CD98A8A48A697674CA9CB00A0B2FE1B90895D89C7D2326FE6F2A341ACE0FB9F97486540B4CD9E8847AB8CFED4D9ABF8A61C016C2CFB0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 1/2] test: introduce asserts assert_str{_not}_equal 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Sergey, On 01.11.23, Sergey Kaplun via Tarantool-patches wrote: > Hi, Sergey! > > If some test fails we got the following output: > > | TAP version 13 > | 1..1 > | not ok 1 - lua_concat_testcase > | --- > | location: /home/burii/reviews/luajit/lj-881-lua-concat/test/tarantool-c-tests/lj-881-fix-lua-concat.test.c:81 > | failed_assertion: assert_str_equal > | got: 1652880104 > | expected: -1138225337 > | ... > | # Failed 1 tests out of 1 > > Failed assertion field is incorrect (see the comment above). > But the most important is "got" and "expected" fields, that returns the > addresses of strings, which isn't very meaningful. > > I suggest dumping the strings instead if they are not long enough (less > than 128 symbols, I suppose). The maxdump string length should be > a customizeable parameter. I suggest defining a macro `MAX_DUMP_STRLEN` > inside the header. So the user can redefine it before the > `assert_str_{not_}equal()` and use a custom value. > > If the string is too long, we should dump the offset of the mismatched > symbol. Or maybe it's better to always dump it. > > Thoughts? What if the different part starts after 128 symbols? I believe the most valuable part is the one where the difference starts, so you have to dump the beginning (for convenience), the difference and some numeric parameters (length, offset where strings differ, etc). Furthermore, I suggest implementing <*_str_*> helpers for nul-terminated strings and <*_mem_*> helpers for length limited memory blobs. > > Side note: > > Also, this comparing "by eye" isn't very convenient if values aren't > aligned, so maybe it is better to use spaces instead of tabs to align > values? This may be added within the separate patch series later. I believe, this is quite minor thing (at least for now). > > > -- > Best regards, > Sergey Kaplun -- Best regards, IM