Perl test tools

No label please

– Test::Simple (or Test::More) is proven and used by many CPAN modules.
– Test::Tutorial covers Test::Simple and Test::More
regression test is easy with Test::Harness. After every edit, you can type a one-liner to quickly rerun any number of existing tests.

– “Write tests before writing the code”, for Java and Perl P420 [[ Perl Best Practices ]]

– “Calculate the *coverage* of your test suite”, ie . See Perl’s Devel::Cover and P87 [[ Mastering Perl ]]. You can see how many percent of your codebase is “covered” by the test suite.

– [[ Perl Testing: A Developer’s Notebook ]] is an entire O’Reilly book devoted to Perl testing.

wait() means

this.wait() means

“current thread please release lock [1] on THIS and join the wait-set inside THIS waiting-area. When something happens in THIS waiting-area, u will reaquire the same lock and then wake up to join the Eligible-club[6].”

[1] if u call this.wait() without a lock on THIS, u get error.
[6] see blog post on Eligible^Running

Q: What happens when a thread returns from wait()?
A: the thread must be patient for a while to reaquire the lock (perhaps from the notifying thread), enter the Eligible-club, receive the CPU slot and run the next statement.

Current thread must clean up [2] the shared toilet before joining the wait-set, since current thread gives lock away to other threads to enter the “shared toilet”.

[2] “clean-up” = don’t leave any object in an inconsistent state. In imprecise terms, Rollback or commit.

subclass static field hiding a super class non-static field@@

short answer is yes.

1. static String fiveCharName; // comment out this, and line 3
would refer to superclass non-static field
2. public GwrPort(String uid, XMLElement xe) {
3. this.fiveCharName=”GWRPT”;
4. super.fiveCharName=”testing”; // always refers to the superclass field

Long answer: the “hiding” mechanism may not cover static-hiding-non-static. Not sure about the terminology.

A field that has the same name as a field in the superclass hides the superclass’s field, even if their types are different. Generally speaking, we don’t recommend hiding fields as it makes code difficult to read.

http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html shows examples of hiding static/non-static fields