Re: Structuring a library project—best practices?

Bill Baxter wbaxter at gmail.com
Wed Feb 11 13:10:04 PST 2009


On Thu, Feb 12, 2009 at 4:39 AM, Joel C. Salomon <joelcsalomon at gmail.com> wrote:
> I'm starting work on my Geometric Algebra library
> <http://www.dsource.org/projects/gald>, and I'd like some tips on
> structuring the source tree. Is there a "standard" place to put the
> library test/demonstration?
>
> Right now I'm starting with:
>
> trunk/
>      gald/
>           e2.d
>      test.d
>      dsss.conf
>
> with the files as follows:
>
> e2.d:
>        module gald.e2;
>
>        struct vector2 {
>                real x;
>                real y;
>        }
>
> test.d:
>        module test;
>
>        import gald.e2;
>
>        int main(char[][] args) {
>                vector2 v;
>                return 0;
>        }
>
> dsss.conf:
>        name=gald
>        [gald]
>        [test.d]
>        target=test_gald
>
> Is this a reasonable start, or am I buying trouble for myself with the
> layout and module declarations? What are the "best practices" for such a
> project?
>
> —Joel Salomon
>

That looks ok to me.  You might end up with more tests, so you might
want to put test.d  in a "tests" or "gald_tests" subdir instead at the
top level.

--bb


More information about the Digitalmars-d-learn mailing list