15 Jan 2019 22:48:52 UTC
- Distribution: GraphViz-Data-Structure
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (239 / 0 / 1)
- KwaliteeBus factor: 1
- % Coverage
- License: unknown
- Activity24 month
- Download (40.06KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:1 non-PAUSE userMCMAHON Joe McMahonand 1 contributors
- Joe McMahon (email@example.com)
build_test - build/verify the test data for GraphViz::Data::Structure
dottyand verify that the test is visually correct:
Build the tests without running
build_test --no-dotty testname
GraphViz::Data::Structureis a bit more difficult to test than some Perl modules. Since "bad" (i.e., visually-unappealing or incorrect) output can only be checked visually, we have a bit of a problem turning this into text-based tests.
build_testsgets around this problem by creating a "pre-test" suite for
GraphViz::Data::Structure. Each pre-test runs a set of data structures through
GraphViz::Data::Structure; the output is run through
dottyto allow the developer to do the visual check. At the same time, a
.tfile is created in the module's
.tfile can check the output of
GraphViz::Data::Structureto make sure that the output is consistent.
It is recommended that anyone developing, modifying, or maintaining
build_testas needed after each change to verify that the modifications that were made do indeed draw the correct picture. Often it will be found that running just a single test build will be sufficient to check the enw code, but you should always run all of them before signing off on a change.
If new functionality is added to
GraphViz::Data::Structure, new tests should be added to the
data.infiles in this directory to ensure that the new features get both a visual check and a test in the test suite.
Running all the tests together from one driver program can lead to problems with cross-contamination of the old with the new; this is paticularly a problem with globs. This is why the tests are run one by one.
data.infiles have the following format:
(name => 'undef', code => 'GraphViz::Data::Structure->new(undef)->graph->as_canon', ) %% (name => 'atom', code => 'GraphViz::Data::Structure->new(1)->graph->as_canon', ) %% ...
Each one is a valid hash initializer, with the
codekeys required. The name is the name to be associated with the test, and
codeis the actual code to be executed to create and visualize the data structure.
You should name your
data.infiles in a manner consistent with the other tests: ddname.data.in, where "dd" is a two-digit number, and "name" is an arbitrary name to be associated with the test(s) in this file.
When you add or change function in
GraphViz::Data::Structure, do the following:
- 1. Create a new
data.infile containing the tests you want to run.
- 2. In this directory, run
perl build_test testname.
- 3. Verify that the output of the test is visually pleasing and accurate.
cd ..and run
make testto verify that the new test is OK and passes.
Obviously, it would be nice if there was an easy way to get the
Makefile.PLto handle the running of
build_testsappropriately, but there doesn't seem to be an easy way to do that.
Always remember: you have to do a
build_testswhen you've changed the module! Otherwise you build tests based on the old code instead of the new changes.
Module Install Instructions
To install GraphViz::Data::Structure, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install GraphViz::Data::Structure
For more information on module installation, please visit the detailed CPAN module installation guide.