Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a test+fix for isotope pattern generation for C10000 #190

Merged
merged 3 commits into from Feb 1, 2016

Conversation

tomas-pluskal
Copy link
Contributor

The test is failing at the moment due to NullPointerException somewhere in IsotopePatternManipulator

java.lang.NullPointerException
    at org.openscience.cdk.formula.IsotopePatternManipulator.sortByMass(IsotopePatternManipulator.java:131)
    at org.openscience.cdk.formula.IsotopePatternGenerator.getIsotopes(IsotopePatternGenerator.java:113)
    at org.openscience.cdk.formula.IsotopePatternGeneratorTest.testCalculateIsotopesC10000(IsotopePatternGeneratorTest.java:266)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

The test is failing at the moment due to NullPointerException
@johnmay
Copy link
Member

johnmay commented Jan 26, 2016

Can you help with the fix, don't like adding tests for stuff without a fix otherwise they just ignored.

I can fix the the NPE by making this value Double.Max.

But then the assertion on number of isotopes fails...

java.lang.AssertionError: 
Expected :98
Actual   :44

Any ideas?

@johnmay
Copy link
Member

johnmay commented Jan 26, 2016

Also ouch that N^2 sort... in sortByMass

@tomas-pluskal
Copy link
Contributor Author

I guess 44 is the correct result. I didn't realize the intensities were in the scale 0 to 1.
I will commit a fix.

@tomas-pluskal
Copy link
Contributor Author

Fix added

@tomas-pluskal tomas-pluskal changed the title Added a test for isotope pattern generation for C10000. Added a test+fix for isotope pattern generation for C10000. Jan 26, 2016
@tomas-pluskal tomas-pluskal changed the title Added a test+fix for isotope pattern generation for C10000. Added a test+fix for isotope pattern generation for C10000 Jan 26, 2016
@johnmay
Copy link
Member

johnmay commented Feb 1, 2016

Looks good, don't see any failures. Thanks

johnmay added a commit that referenced this pull request Feb 1, 2016
Added a test+fix for isotope pattern generation for C10000
@johnmay johnmay merged commit 35e874e into cdk:master Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants