Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHhbN-0000CY-Fa for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Oct 2019 05:00:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHhbK-0002bo-5S for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Oct 2019 04:59:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHhbJ-0002bU-GA for pgsql-hackers@lists.postgresql.org; Tue, 08 Oct 2019 04:59:57 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iHhbC-0004mS-Ec for pgsql-hackers@lists.postgresql.org; Tue, 08 Oct 2019 04:59:55 +0000 Received: by mail-pl1-x636.google.com with SMTP id d22so7967597pls.0 for ; Mon, 07 Oct 2019 21:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MwORCzIALesTcqbESoY/nQcSqYVeE22azNX7jk2VUcg=; b=T+urRep6f9SkQP/PZme0BLjQUI283smx1LnSbv6rL8KY+Xf3y8CHpPigCXBzUZ5Qvr o8/7vTwuMAkZr+NI4KX96vMOM5OebdVRC8VVuwCJK8Dvda9u1DEZqNXNZEEzMdAjhiw7 JSZ13MIETfaRRTr6uaN1G1yb+kupUUKjCftvU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=MwORCzIALesTcqbESoY/nQcSqYVeE22azNX7jk2VUcg=; b=bfmVvhBm35Lp6cmRjuxLFzqkfxDjvYGdL4xwMk2z1AQ2UGl8wqSbdwbexZylhmdH5h zPGK7+8Z0KuZBKKG+/otQWGw/kbY4xIxpHiWFvb1N3dEatBU4iCeW6D9ncWio3wkfFNb B6CubQ2HXG32TOOwfx/1/5LPR5HHMs3R1pcJyZUNqiQXzEEE/9iouQjvGo4+If119+Iw gK/jc4ozVGN7Rq9qGC8gyBgeI5jtTpM8J/Vl1xe7XmCn+ayagVaxrIU8hcteAKERz1QF /i3PWIl00BAlwXnzaqrxtTLtdEXdckuCRaGBRSMud8ZM2dgsLxssrCicNWB121OiAIAX 42UQ== X-Gm-Message-State: APjAAAXtUbefGwx7kDPFQwkIOd9PLOcoXDpW3W3y2otlrWEYUAgEqsMH k527YvrJudlnWo4blVWGJqOqrg== X-Google-Smtp-Source: APXvYqwZ9HDhAGE1vuiuGOdoPZub5pMW5Gqm70L5TUJEXuzEmdb5feyW//Y4+/Bm5ZgwrUtGhVhk7A== X-Received: by 2002:a17:902:850b:: with SMTP id bj11mr34100511plb.39.1570510788655; Mon, 07 Oct 2019 21:59:48 -0700 (PDT) Received: from rfd.leadboat.com (108-233-125-46.lightspeed.sntcca.sbcglobal.net. [108.233.125.46]) by smtp.gmail.com with ESMTPSA id k15sm4618366pgt.25.2019.10.07.21.59.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2019 21:59:47 -0700 (PDT) Date: Mon, 7 Oct 2019 21:59:46 -0700 From: Noah Misch To: Peter Eisentraut Cc: Andres Freund , pgsql-hackers@lists.postgresql.org Subject: Re: expressive test macros (was: Report test_atomic_ops() failures consistently, via macros) Message-ID: <20191008045946.GA4054860@rfd.leadboat.com> References: <20191005190729.6sx7g23ifdu65s7s@alap3.anarazel.de> <20191006022038.GB4023404@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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).