[Tarantool-patches] [PATCH v6 2/3] test: add a test for wal_cleanup_delay option

Cyrill Gorcunov gorcunov at gmail.com
Tue Mar 30 10:19:56 MSK 2021


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?


More information about the Tarantool-patches mailing list