[Tutor] DATA TYPES

Michael Langford mlangford.cs03 at gtalumni.org
Thu Feb 21 04:59:54 CET 2008


>  - Since the OP is trying to find cases where the same variable is
>  assigned different types, presumably in a single scope, checking just at
>  the end of a function won't help.

This is a starting point to get the type for the variables when you
start the port, before you run the unit tests.

>  > After you've done that, you can see what type is referred to by each
>  > name at the end of the function, then with some unit tests you should
>  > be able to tell if you temporarily changed to a different data type in
>  > the middle. If nothing else, you should be able to write the unit
>  > tests in jython/cpython compatable code so you don't have to write
>  > them twice.
>
>  Not sure how you would do that with unit tests?

You write unit tests for each of your functions that test their input
and output. Presumably, if you used a float somewhere in the middle
there, when you don't use the float in the java implementation, you'll
get a different answer. If you don't get a different answer,
presumably it didn't matter, or your tests don't provide good enough
coverage of the number space. By writing the unit tests in
cPython/Jython compatible code, you'll be able to run the same tests
on both sets of functions and verify you've completed your port.

           ==Michael

PS: Sorry about the missing %, it was there when I ran the code. Don't
know where it went.

-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com


More information about the Tutor mailing list