Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: A proper name for is_sorted function that can check more than just sorting order?

by Dallaylaen (Chaplain)
on Dec 28, 2017 at 09:18 UTC ( [id://1206308]=note: print w/replies, xml ) Need Help??


in reply to Re: A proper name for is_sorted function that can check more than just sorting order?
in thread A proper name for is_sorted function that can check more than just sorting order?

Generally I prefer to use simple constructs, especially in tests. However, sometimes a well-defined wrapper is better. Something like Test::Warn:

warnings_like { my_fucntion() } [ {carped => qr/deprecated.*our_function/} ], "Warning issued, alter +native suggested";

This can be written with $SIG{__WARN__} and like, but why bother? The intention is clear from this code.

My proposed "test that condition holds for all adjacent values in an array" looks pretty well-defined to me. And if it's insufficient, there's always subtest and a for loop...

  • Comment on Re^2: A proper name for is_sorted function that can check more than just sorting order?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1206308]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-25 14:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found