/v3.2/nimbits-tds/test/TestWolframAlpha.java

http://nimbits-server.googlecode.com/ · Java · 41 lines · 14 code · 5 blank · 22 comment · 0 complexity · 9dfca7f51bc4dcc6a31113acdef472e2 MD5 · raw file

  1. /*
  2. * Copyright (c) 2010 Tonic Solutions LLC.
  3. *
  4. * http://www.nimbits.com
  5. *
  6. *
  7. * Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
  8. *
  9. * http://www.gnu.org/licenses/gpl.html
  10. *
  11. * Unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  12. */
  13. import com.nimbits.client.exception.NimbitsException;
  14. import com.nimbits.server.wolframalpha.WolframAlphaImpl;
  15. import org.junit.Test;
  16. import org.xml.sax.SAXException;
  17. import javax.xml.parsers.ParserConfigurationException;
  18. import java.io.IOException;
  19. import static org.junit.Assert.assertEquals;
  20. /**
  21. * Created by Benjamin Sautner
  22. * User: bsautner
  23. * Date: 8/18/11
  24. * Time: 1:44 PM
  25. */
  26. public class TestWolframAlpha {
  27. @Test
  28. public void testWolframAlpha() throws ParserConfigurationException, IOException, SAXException, NimbitsException {
  29. WolframAlphaImpl i = new WolframAlphaImpl();
  30. assertEquals(2.0, i.getFormulaResult("1+1"), 0.0);
  31. // assertEquals(25.0, i.getFormulaResult("5*5"), 0.0);
  32. // assertEquals(1.0, i.getFormulaResult("5/5"), 0.0);
  33. // assertEquals(5.0, i.getFormulaResult("square root of 25"), 0.0);
  34. // assertEquals(5.0, i.getFormulaResult("average decimal value {25,16,22,34}"), 0.0);
  35. }
  36. }