From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:93:: with SMTP id 141-v6mr2900245ita.55.1525799370367; Tue, 08 May 2018 10:09:30 -0700 (PDT) X-Received: by 2002:a9d:3c4:: with SMTP id f62-v6mr2853517otf.8.1525799369060; Tue, 08 May 2018 10:09:29 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.linkpendium.com!news.linkpendium.com!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!u74-v6no521919itb.0!news-out.google.com!b185-v6ni553itb.0!nntp.google.com!u74-v6no521916itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 8 May 2018 10:09:28 -0700 (PDT) In-Reply-To: <2018042711034634047-contact@flyx.org> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=198.208.47.96; posting-account=AgomvAoAAAAj6rtZlNDUf1S1XVXbXDpg NNTP-Posting-Host: 198.208.47.96 References: <7bc351f9-3373-4d48-95c3-c081cb5506f3@googlegroups.com> <2018042711034634047-contact@flyx.org> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <107d577c-e872-4259-84c4-e68a63ce6b0e@googlegroups.com> Subject: Re: Ada aunit examples From: Michael Hardeman Injection-Date: Tue, 08 May 2018 17:09:30 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:52114 Date: 2018-05-08T10:09:28-07:00 List-Id: On Friday, April 27, 2018 at 5:03:48 AM UTC-4, Felix Krause wrote: > AdaYaml [1] uses AUnit. > > On 2018-04-27 04:57:56 +0000, Michael Hardeman said: > > > > I want to see an example of a good test structure. > > What is a harness, and how is it used? > > It's your main executable that you call to run the tests. It > instantiates the test runner with the suite you want to run and > optionally sets up reporting. In AdaYaml, I have one harness per suite, > and each enables colors for the reporting output (green / red for > passed / failed tests). You could also do things like having one single > harness for all suites, and then selecting the suite with a command > line parameter. > > > What is a test suite, and how is it used? > > It groups a set of test cases. Since each test case can actually > consist of multiple tests, suites are a bit superfluous for small > projects since they introduce a hierarchy level in your test structure > that you might not actually need. > > How you use suites depends on your project. In AdaYaml, I have two > suites: On including all test cases concerned with loading YAML data, > and one including all test cases concerned with dumping YAML data. This > makes sense for me since the code used for loading and dumping is > fairly disjoint and when I change anything on the loading side, it > suffices to run the loading test suite to check whether I broke > anything. > > Initially, I had one test suite for each component (Lexer, Parser, > DOM-Composer), but that basically meant that each suite contained a > single test case. This was arguably better for running only a specific > test case, but in the end, I decided that since all tests run in under > one second, I can simply merge them. > > > How do I integrate it properly into my gpr project files? > > You create a new project file that compiles your tests, for example > project-tests.gpr (AdaYaml has yaml-tests.gpr). That makes the test > project a child of the main project. It typically makes sense to use > the same compiler options for the tests as you use for the main > project, like so: > > package Compiler renames Yaml.Compiler; > > If you have scenario variables in your main project that alter > compilation behavior (e.g. for debug/release builds), this will then > also affect the test builds. In more complex scenarios, you may need to > access the main project's scenario variables and include different > tests based on what optional features are enabled in your main project. > > > [1]: https://github.com/yaml/AdaYaml > > -- > Regards, > Felix Krause Hey Felix, I'm in the process of restructuring my project to add AUnit, based on your example, and I'm confused by this line. I in your code, what does this line do? https://github.com/yaml/AdaYaml/blob/develop/test/src/yaml-lexer-buffering_test.adb#L28