Closed frauzufall closed 4 years ago
Thanks for the comments @imagejan!
About testing guessParser
for Long
and Float
: I'm not sure how to do this right and I'm also not sure if the guessParser
method works as expected there.
This test fails, because the String can and therefore will be interpreted as Integer:
assertEquals(3L, DefaultTableIOPlugin.guessParser("3L").apply("3L"));
Using a number too big for an Integer should work, I thought, but this also fails and I don't understand why:
assertEquals(36564573745634564L, DefaultTableIOPlugin.guessParser("36564573745634564L").apply("36564573745634564L"));
Here is the result:
java.lang.AssertionError:
Expected :36564573745634564
Actual :36564573745634564L
Similar problem with Float
vs Double
. Maybe I'm missing something very basic about how numbers are represented.
@frauzufall wrote:
assertEquals(36564573745634564L, DefaultTableIOPlugin.guessParser("36564573745634564L").apply("36564573745634564L"));
36564573745634564L
will be interpreted as a String
because of the trailing L
, no?
I added a slightly modified line:
... and it passes.
However, we now still have dead code with the Float.valueOf
, as this one will never be reached because any decimal number can be interpreted by Double.valueOf
here:
@imagejan Thanks! I removed the dead code. It will just always use double when guessing, that's fine, right? I'm sure the guessing can be further improved, but we probably need to release a new version of this repo too before uploading the most recent version of scijava-table
to Fiji..
This PR is addressing https://github.com/scijava/scijava-table/issues/22 and making the
DefaultTableIOPlugin
compatible with the latestscijava-table
version.Changes:
DefaultTableIOPlugin
extendsTableIOPlugin
TableIOOptions
instead