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

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Mar 30 01:56:47 MSK 2021


On 30.03.2021 00:40, Cyrill Gorcunov wrote:
> On Tue, Mar 30, 2021 at 12:19:10AM +0200, Vladislav Shpilevoy wrote:
>>>
>>> I need to make sure the .is_paused is false, the assert(x == false)
>>> looks exactly what is needed. and we have similar code in our other
>>> tests, do you prefer assert(not x.is_paused) or what?
>>
>> And there is much much much more tests using the booleans as they
>> are supposed to be used. Why do you need exactly 'false' as a literal?
> 
> 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
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();


More information about the Tarantool-patches mailing list