3 ms·
here's an example - i'm currently working through porting the blossom algorithm [http://jorisvr.nl/article/maximum-matching http://jorisvr.nl/article/maximum-ma
by zem 3y ago
here's an example - i'm currently working through porting the blossom algorithm [http://jorisvr.nl/article/maximum-matching http://jorisvr.nl/article/maximum-matching] to elixir. the algorithm is complex and has a lot of subparts, but the public interface to it is extremely simple. i feel like it's not just useful but almost essential to test a lot of the little parts in isolation so i can make sure they are working correctly.
i am currently marking all functions as public for simplicity, but i feel like it's a failing of elixir and/or its test framework that i cannot say "private, but an associated test module should be able to see them", and once the code is done i will be exploring some of the third-party solutions people have come up with to hack around the issue. (the other option, of course, is to have a new module that just contains a couple of public methods, and regard the entire implementation module as a private module with public functions)
- randomdata 3y agoGo comes with this kind of “public” and “private” separation. Only the private tests can access private functions. It also serves to differentiate which tests are for API documentation, which the API must conform to forevermore, and which were used to help with development and can be considered throwaway. I'm not sure why all testing frameworks don't have this.