Re: HOWTO: Writing Perl6 Tests (was: Project Start: Section 1)

[email protected] ("Dave Whipp")
Newsgroups perl.perl6.documentation
Organization Fast-Chip inc.
Message-ID <[email protected]>
"Andrew Wilson" <[email protected]> wrote
> Perl's tests are built on Test::More, it uses ok() and is() not
> assert().  If we're going to be doing test cases for perl 6 then we
> should do them using perl's standard testing format (i.e. Test::More,
> Test::Harness, etc.)

I would argue that we should write our tests using perl6's standard
format -- and we need to define that format. There may be a good
argument for using the perl5 standards; but we should explore the
alternatives. "assert" is a generally accepted term: I'm not sure
why perl should be different.

> If your program can't do basic I/O it's probably pretty broken.  Even if
> we we're to only rely on the test modules, they also need to be able to
> communicate with the outside world.

My day-job is ASIC verification: in a previous job I tested
microprocessor cores. We generally found mechanisms to communicate
pass/fail without requiring any IO capability. A common method is to
use the programm counter -- if we execute the instruction at address
0x123456, then exit as a PASS; if we reach 0x654321, then fail. (we
used the assembler to get the addresses of specific pass/fail labels).

We don't need to go to these extremes for perl testing, because we have
an exit(int) capability. exit(0) means pass: anything else (including
timeout)
is a fail.

The fact that we don't need C<print> is not a good argument for
not using it. Perl tests should assume that Parrot works!


Dave.

--
Dave Whipp, Senior Verification Engineer,
Fast-Chip inc., 950 Kifer Rd, Sunnyvale, CA. 94086
tel: 408 523 8071; http://www.fast-chip.com
Opinions my own; statements of fact may be in error.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.