Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v6 2/3] test: add a test for wal_cleanup_delay option
Date: Tue, 30 Mar 2021 10:19:56 +0300	[thread overview]
Message-ID: <YGLRHBzxs1P2Zlsh@grain> (raw)
In-Reply-To: <5195a08c-aaa7-7aa4-8324-352a9433955f@tarantool.org>

On Tue, Mar 30, 2021 at 12:56:47AM +0200, Vladislav Shpilevoy wrote:
> > 
> > Wait, I just don't understand. is_paused is a boolean type and
> > I compare it with a boolean value. Could you simply point me
> > the preferred way to compare if some particular value is false.
> > I used assert() 'cause I found similar code, if there some more
> > suiatble way to test the value, sure thing I can use whatever
> > you prefer, just point me an example.
> 
> Ok, I open the latest replication test we added (gh-5536), and
> I see the line
> 
> 	assert(box.space.test:count() == 10)
> 
> It does not look like this:
> 
> 	assert((box.space.test:count() == 10) == true)
> 
> does it? Because it is pointless to have 'boolean' type in a

This is because the count() is a numeric value. What had been
there if 'count()' would return a boolean?

> language if you do the manual comparison with the boolean
> constants anyway.
> 
> The same as in C you don't code like this:
> 
> 	bool ok = func();
> 	if (ok == false)
> 		error();
> 
> You do:
> 
> 	bool ok = func();
> 	if (!ok)
> 		error();
> 

I still don't get it. The examples I see is the following

test/sql/checks.result:assert(box.space.TEST.ck_constraint.CK.is_enabled == false)
test/sql/checks.result:assert(box.space.TEST.ck_constraint.CK.is_enabled == true)

Vlad, lets move another way. I suspect there are 3 ways to compare

1) assert(is_paused == false)
2) assert(not is_paused)
3) is_running = not is_paused
   assert(is_running)

so which of them I should use?

  reply	other threads:[~2021-03-30  7:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-27 11:13 [Tarantool-patches] [PATCH v6 0/3] gc/xlog: delay xlog cleanup until relays are subscribed Cyrill Gorcunov via Tarantool-patches
2021-03-27 11:13 ` [Tarantool-patches] [PATCH v6 1/3] " Cyrill Gorcunov via Tarantool-patches
2021-03-27 11:13 ` [Tarantool-patches] [PATCH v6 2/3] test: add a test for wal_cleanup_delay option Cyrill Gorcunov via Tarantool-patches
2021-03-29 21:07   ` Vladislav Shpilevoy via Tarantool-patches
2021-03-29 21:46     ` Cyrill Gorcunov via Tarantool-patches
2021-03-29 21:54       ` Vladislav Shpilevoy via Tarantool-patches
2021-03-29 21:57         ` Cyrill Gorcunov via Tarantool-patches
2021-03-29 22:19           ` Vladislav Shpilevoy via Tarantool-patches
2021-03-29 22:40             ` Cyrill Gorcunov via Tarantool-patches
2021-03-29 22:56               ` Vladislav Shpilevoy via Tarantool-patches
2021-03-30  7:19                 ` Cyrill Gorcunov via Tarantool-patches [this message]
2021-03-30 11:55                   ` Cyrill Gorcunov via Tarantool-patches
2021-03-30 19:59                   ` Vladislav Shpilevoy via Tarantool-patches
2021-03-27 11:13 ` [Tarantool-patches] [PATCH v6 3/3] test: box-tap/gc -- add test for is_paused field Cyrill Gorcunov via Tarantool-patches
2021-03-30 19:57 ` [Tarantool-patches] [PATCH v6 0/3] gc/xlog: delay xlog cleanup until relays are subscribed Vladislav Shpilevoy via Tarantool-patches
2021-03-31  8:28 ` Kirill Yukhin via Tarantool-patches

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=YGLRHBzxs1P2Zlsh@grain \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v6 2/3] test: add a test for wal_cleanup_delay option' \
    /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