From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102844 invoked by alias); 3 Sep 2016 00:32:49 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 102826 invoked by uid 89); 3 Sep 2016 00:32:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.0 required=5.0 tests=BAYES_40,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=trump, pitfall, Hx-languages-length:870, HTo:U*carlos X-HELO: topped-with-meat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Carlos O'Donell Cc: GNU C Library , Florian Weimer Subject: Re: Consensus on unit tests? In-Reply-To: Carlos O'Donell's message of Friday, 24 June 2016 19:59:12 -0400 <92609f90-7a53-a455-ca72-b9baae224a38@redhat.com> References: <92609f90-7a53-a455-ca72-b9baae224a38@redhat.com> Message-Id: <20160903003246.6156E2C3A08@topped-with-meat.com> Date: Sat, 03 Sep 2016 00:32:00 -0000 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=Tvt12lnh c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=GD2RICCCMMq7DvZXTAEA:9 a=CjuIK1q_8ugA:10 X-SW-Source: 2016-09/txt/msg00051.txt.bz2 You asked about the general concept of unit tests, and the following discussion was only about the technical issues with the specific code in your example. I think the general notion of unit tests is a very good one. I don't see any obvious problems in the approach you've taken to building a unit test. Of course, any particular refactoring change to enable unit testing might have issues and "It's for a unit test!" is not any kind of trump over usual review concerns. The likely pitfall I would look out for is when breaking some function out into its own file to make it unit-testable might perturb the optimization opportunities for the function in the actual build. We should be careful about that. In your first example, the function was already global, so there is no particular reason to worry about that issue. Thanks, Roland