mirror of
https://github.com/DanilaFe/abacus
synced 2024-11-19 00:49:32 -08:00
Add tests for basic operations.
This commit is contained in:
parent
a964f8982c
commit
e4d8ae256e
|
@ -2,6 +2,7 @@ package org.nwapw.abacus.tests;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
import org.nwapw.abacus.Abacus;
|
import org.nwapw.abacus.Abacus;
|
||||||
import org.nwapw.abacus.number.NumberInterface;
|
import org.nwapw.abacus.number.NumberInterface;
|
||||||
import org.nwapw.abacus.plugin.StandardPlugin;
|
import org.nwapw.abacus.plugin.StandardPlugin;
|
||||||
|
@ -33,4 +34,24 @@ public class CalculationTests {
|
||||||
Assert.assertNull(abacus.evaluateTree(parsedTree));
|
Assert.assertNull(abacus.evaluateTree(parsedTree));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddition(){
|
||||||
|
testOutput("9.5+10", "(9.5+10)", "19.5");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSubtraction(){
|
||||||
|
testOutput("9.5-10", "(9.5-10)", "-0.5");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMultiplication(){
|
||||||
|
testOutput("9.5*10", "(9.5*10)", "95");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDivision(){
|
||||||
|
testOutput("9.5/2", "(9.5/2)", "4.75");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user