From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 1A037469719 for ; Thu, 12 Nov 2020 01:07:14 +0300 (MSK) References: <20201105120923.10940-1-i.kosarev@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Wed, 11 Nov 2020 23:07:12 +0100 MIME-Version: 1.0 In-Reply-To: <20201105120923.10940-1-i.kosarev@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v4] core: introduce evenly distributed int64 random in range List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ilya Kosarev Cc: tarantool-patches@dev.tarantool.org Hi! Thanks for the fixes! I hope we will end this eventually :) See 2 comments below. > diff --git a/test/unit/random.c b/test/unit/random.c > new file mode 100644 > index 000000000..858ff7867 > --- /dev/null > +++ b/test/unit/random.c > @@ -0,0 +1,56 @@ > +#include > + > +#include > +#include > + > +#include "unit.h" > + > +static void > +test_random_in_range_one(int64_t min, int64_t max) > +{ > + int64_t result = pseudo_random_in_range(min, max); > + assert(min <= result && result <= max); > + if (min == max) > + printf("pseudo_random_in_range(%lld, %lld) = %lld\n", > + (long long)min, (long long)max, (long long)result); > + > + result = real_random_in_range(min, max); > + assert(min <= result && result <= max); > + if (min == max) > + printf("real_random_in_range(%lld, %lld) = %lld\n", > + (long long)min, (long long)max, (long long)result); 1. By using printf as a checker you complicate Sergey's life in scope of this https://github.com/tarantool/tarantool/issues/5000. Because your output is not TAP. Better not print anything except via helpers from unit.h, and use ok()/is()/isnt() for actual tests. > +} > diff --git a/test/unit/swim_test_utils.c b/test/unit/swim_test_utils.c > index 9dbd28a9f..7ac43d82d 100644 > --- a/test/unit/swim_test_utils.c > +++ b/test/unit/swim_test_utils.c > @@ -875,7 +875,8 @@ swim_run_test(const char *log_file, fiber_func test) > * Print the seed to be able to reproduce a bug with the > * same seed. > */ > - say_info("Random seed = %llu", (unsigned long long) seed); > + say_info("Random seed = %llu", (unsigned long long)seed); 2. Why did you change this line?