<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 2, 2009, at 1:48 PM, Misha Brukman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">2009/1/2 Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div style=""><div><div class="Wj3C7c"><div><div>On Jan 2, 2009, at 12:21 PM, Misha Brukman wrote:</div></div></div></div><div>Do you have a specific example of a unit test that would need these?  I really think these should stay private.</div> </div></blockquote><div><br>Let's take lib/Transforms/Utils/CodeExtractor.cpp .  The public interface for it is in include/llvm/Transform/Utils/FunctionUtils.h, with only the high-level API.<br><br>If I want to test some corner-case (consider the number of code paths in that code), I have to strain to come up with some combination of a Function and input BasicBlocks that will fit all the conditions from the outset.  Or, I can just feed each individual method in the class exactly the corner cases I will want it to handle, and verify its output (or side effects) exactly, to make sure I pin-pointed the issue.</div></div></blockquote><div><br></div>Sure, ok.  But that is a public API, I'm specifically interested in cases you need private API.</div><div><br></div><div><blockquote type="cite"><div class="gmail_quote"><div>Or, let's say I want to write some tests for the LLParser -- the only public API is "ParseAssemblyString", I can't unittest each individual method.  The unittest for this using the public API will be very brittle as it would have to check the contents of the returned error message, instead of calling each Parse*() function directly and analyzing its output.</div></div></blockquote><div><br></div><div>The code is structured so that it is trivially easy to construct testcases for anything you're concerned with.  If you give me an example, I'll give you a testcase (in .ll form).  I don't see the need for unittests for LLParser.</div><div><br></div><div>-Chris</div></div></body></html>