From: "Ilya Kosarev" <i.kosarev@tarantool.org> To: "Vladislav Shpilevoy" <v.shpilevoy@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH v4] core: introduce evenly distributed int64 random in range Date: Fri, 13 Nov 2020 14:54:03 +0300 [thread overview] Message-ID: <1605268443.814718656@f380.i.mail.ru> (raw) In-Reply-To: <c486b384-600a-9b7c-ec46-d279f986d0af@tarantool.org> [-- Attachment #1: Type: text/plain, Size: 1949 bytes --] Hi! Sent v5 of the patch with fixes. >Четверг, 12 ноября 2020, 1:07 +03:00 от Vladislav Shpilevoy <v.shpilevoy@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 <core/random.h> >> + >> +#include <stdio.h> >> +#include <assert.h> >> + >> +#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. Thanks, didn’t really know this one. > >> +} >> 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? Yes, no need to change it -- Ilya Kosarev [-- Attachment #2: Type: text/html, Size: 2876 bytes --]
next prev parent reply other threads:[~2020-11-13 11:54 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-05 12:09 Ilya Kosarev 2020-11-11 22:07 ` Vladislav Shpilevoy 2020-11-13 11:54 ` Ilya Kosarev [this message] -- strict thread matches above, loose matches on Subject: below -- 2020-11-05 11:14 Ilya Kosarev 2020-11-05 11:07 Ilya Kosarev
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1605268443.814718656@f380.i.mail.ru \ --to=i.kosarev@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v4] core: introduce evenly distributed int64 random in range' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox