commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Reilly" <tim.rei...@consultant.com>
Subject RE: [id] UUID sending more code and a question or two
Date Thu, 22 Jan 2004 07:52:21 GMT
> > That sounds like a PITA and I wonder if we are really thinking
> about this
> > correctly.  Interleaving JNI calls and comparing timestamps will be hard
> > and ultimately inconclusive, IIUC.  What exactly did you have in mind
> here?
>
> Why not run the native code, capture the output, and compare?

Let me start from what brought me to testing the time against the C code. I
was working on UUIDGenerator.java and once far enough along I felt I should
compare the string output from a ms-guid  to the values I generated.
Reversing the time fields should have given me approximate values. It
didn't.  My next step was to add a test to tell me if the time I was
generating was close to the time from someone else's uuid implementation.
Going back to the ietf-draft was an easy choice since the appendix contains
reference C code. After banging my head against the wall due to the time
differences I'd get (which turned out to be an overflow in my C code.) The
java time generation was fine, so I need to look elsewhere.

I agree the JNI will be a PITA for me, especially since I'm re-learning C. I
have a simple program working on Win2K and RH8. I'm not sure if the code
would need to be recompiled for each target platform (at least making it an
optional test might be good)? Perhaps running the test initially was
sufficient? I'm not sure if Phil is minus on the JNI testing or for native
code in the range test realizing what I'd proposed wouldn't work anyhow?
Regardless, both points above are valid. The sample output (run2) below
shows the interleaving calls not working which is logical without some delay
in the calls, and as Noel suggests "capture the output and compare" would
probably be the approach. I don't mind doing the jni (learn something new)
but Phil are you minus on the jni range testing (past my own sanity tests
here) or jni in the unit tests generally speaking?


Sample output from my tests; right now I call an .exe using Runtime.exec...
//Run 1
>From C reference code
132940402931250000
>From java
132940402931250000
>From C reference code
132940402931562500

//Run 2
>From C reference code
132940403477187500
>From java
132940403477180000
>From C reference code
132940403477343750


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message