Skip to content

Instantly share code, notes, and snippets.

@alexejVasko
Created March 22, 2016 14:25
Show Gist options
  • Save alexejVasko/c5b05e8ef2f09686d1a0 to your computer and use it in GitHub Desktop.
Save alexejVasko/c5b05e8ef2f09686d1a0 to your computer and use it in GitHub Desktop.
package calculator;
import org.junit.Assert;
import org.junit.Test;
import static calculator.StringDoubleCalculating.getActionSymbol;
import static calculator.StringDoubleCalculating.precondition;
/**
* Created by Ky on 22.03.2016.
*/
public class StringDoubleCalculatingTest {
@Test
public void test1(){
char symbolFromFunction = getActionSymbol(StringDoubleCalculating.Actions.MULTIPLY);
char expectedSymbol = '*';
Assert.assertEquals(expectedSymbol, symbolFromFunction);
}
@Test
public void test2(){
char symbolFromFunction = getActionSymbol(StringDoubleCalculating.Actions.SUBTRACTION);
char expectedSymbol = 'a';
Assert.assertEquals(expectedSymbol, symbolFromFunction);
}
@Test
public void test3(){
String lineForTest = "22*2";
double expectedResultForTest2 = 44.0;
double result = precondition(lineForTest);
Assert.assertEquals(expectedResultForTest2, result);
}
@Test
public void test4() {
String lineForTest = "234-23";
double expectedResultForTest3 = 211.0;
double result = precondition(lineForTest);
System.out.println(result);
Assert.assertEquals(expectedResultForTest3, result);
}
@Test
public void test5() {
String lineForTest = "234-23";
double expectedResultForTest3 = 211;
double result = precondition(lineForTest);
System.out.println(result);
Assert.assertEquals(expectedResultForTest3, result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment