PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/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
14import com.nimbits.client.exception.NimbitsException;
15import com.nimbits.server.wolframalpha.WolframAlphaImpl;
16import org.junit.Test;
17import org.xml.sax.SAXException;
18
19import javax.xml.parsers.ParserConfigurationException;
20import java.io.IOException;
21
22import static org.junit.Assert.assertEquals;
23
24/**
25 * Created by Benjamin Sautner
26 * User: bsautner
27 * Date: 8/18/11
28 * Time: 1:44 PM
29 */
30public class TestWolframAlpha {
31
32    @Test
33    public void testWolframAlpha() throws ParserConfigurationException, IOException, SAXException, NimbitsException {
34        WolframAlphaImpl i = new WolframAlphaImpl();
35        assertEquals(2.0, i.getFormulaResult("1+1"), 0.0);
36        //  assertEquals(25.0, i.getFormulaResult("5*5"), 0.0);
37        //  assertEquals(1.0, i.getFormulaResult("5/5"), 0.0);
38        //  assertEquals(5.0, i.getFormulaResult("square root of 25"), 0.0);
39        //   assertEquals(5.0, i.getFormulaResult("average decimal value {25,16,22,34}"), 0.0);
40    }
41}