jfroebe has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm relatively new to Test::More so I'm suspecting something is amiss somewhere ;-)

cmp_ok(2048, "ge", 512, "2048 >= 512");

Produces

not ok 12 - 2048 >= 512 # Failed test (t/syb_settings.t at line 118) # '2048' # ge # '512'

Any ideas?? Other cmp_ok with the ge operator works fine. Switching the ge to a lt works which is counter to all the other tests using cmp_ok with ge operator.

Jason L. Froebe

Team Sybase member

No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

Replies are listed 'Best First'.
Re: Problem with Test::More (cmp_ok)
by Corion (Patriarch) on Jul 06, 2005 at 22:24 UTC

    "ge" is the string comparator, not the number comparator. Maybe try cmp_ok( 2048, ">=", 512, "Sanity is there" ); ...

      insert swearing on my part... ARGH!

      Jason L. Froebe

      Team Sybase member

      No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

Re: Problem with Test::More (cmp_ok)
by eyepopslikeamosquito (Archbishop) on Jul 06, 2005 at 22:24 UTC
    You want a numeric compare, not a string compare.
    cmp_ok(2048, ">=", 512, "2048 >= 512");