Ticket #1343 (closed todo: fixed)

Opened 12 years ago

Last modified 12 years ago

parrot's Test::More's is(PMC,Float), with precision

Reported by: coke Owned by: coke
Priority: normal Milestone:
Component: none Version: trunk
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

This option needs better docs in the pod. (specifically, what do you pass in?)

It's defined as a pmc type, but is cast to num and used that way - should probably just be declared as a num type. [0]

Also, when passed, the floats are still compared with iseq first; I would suggest that if we're declaring we want it, we should avoid the direct comparison and just check the diff.

[0](This actually seems to be a common theme with many options across several test::more subs- e.g. is :multi(PMC,Float), but the float parameter is declared as a .pmc, and then cast to a .num - also, many uses of _make_diagnostic first cast the passed in args to string, despite the fact that the sub declares the parameters as string itself)

Change History

Changed 12 years ago by coke

  • summary changed from parrot's Test::More's is(Float,Float), with precision to parrot's Test::More's is(PMC,Float), with precision

Changed 12 years ago by coke

  • owner set to coke

r42966 has minor cleanups to the code in is(), forcing precision check to be used if present, avoiding a lot of casts that autoboxing does for us.

Changed 12 years ago by coke

docs added in r42967.

Changed 12 years ago by dukeleto

I added tests for Float/float comparison in r42987, since only float/float was tested.

Changed 12 years ago by dukeleto

More tests in r42988

Changed 12 years ago by coke

  • status changed from new to closed
  • resolution set to fixed

The original points raised in this ticket have been addressed; docs have been updated, tests of tests have been added, and many unnecessary casts have been removed.

Note: See TracTickets for help on using tickets.