Re: expressive test macros (was: Report test_atomic_ops() failuresconsistently, via macros) - Mailing list pgsql-hackers

From Noah Misch
Subject Re: expressive test macros (was: Report test_atomic_ops() failuresconsistently, via macros)
Date
Msg-id 20191008045946.GA4054860@rfd.leadboat.com
Whole thread Raw
In response to Re: expressive test macros (was: Report test_atomic_ops() failuresconsistently, via macros)  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: expressive test macros (was: Report test_atomic_ops() failuresconsistently, via macros)
List pgsql-hackers
On Mon, Oct 07, 2019 at 09:56:20PM +0200, Peter Eisentraut wrote:
> On 2019-10-06 04:20, Noah Misch wrote:
> >  elog(ERROR, \
> >       "%s yielded %u, expected %s (%u) in file \"%s\" line %u", \
> >       #result_expr, result, #expected_expr, expected, __FILE__, __LINE__); \

> I've been meaning to propose some JUnit-style more-specific Assert
> variants such as AssertEquals for this reason.  But as Tom writes
> nearby, it should be a straight wrapper around Assert, not elog.  So
> these need to be named separately.

Agreed.

> Btw., JUnit uses the ordering convention assertEquals(expected, actual),
> whereas Perl Test::More uses is(actual, expected).  Let's make sure we
> pick something and stick with it.

Since we write "if (actual == expected)", I prefer f(actual, expected).  CUnit
uses CU_ASSERT_EQUAL(actual, expected).



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Two pg_rewind patches (auto generate recovery conf and ensureclean shutdown)
Next
From: Michael Paquier
Date:
Subject: Re: Non-Active links being referred in our source code