EvalPolynomialCplx: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 11: | Zeile 11: | ||
====JUnit Tests==== | ====JUnit Tests==== | ||
<syntaxhighlight lang="java" class="mw-collapsible mw-collapsed"> | <span class="mw-customtoggle-myDivision">[Anzeigen]</span> | ||
<syntaxhighlight lang="java" class="mw-collapsible mw-collapsed" id="mw-customcollapsible-myDivision"> | |||
@Before | @Before | ||
public void beforeTest() { | public void beforeTest() { |
Version vom 27. Juni 2017, 09:26 Uhr
Beschreibung
Syntax
evalPolynomialCplx(string1,string2,string3)
Parameter
Return Value
Beispiele
JUnit Tests
[Anzeigen]
@Before
public void beforeTest() {
placeFillInVariable(1, OMParser.parse("0"));
placeFillInVariable(2, OMParser.parse("1"));
placeExerciseVariable("a", OMParser.parse("0"));
placeExerciseVariable("b", OMParser.parse("1"));
}
@Test
public void testEvalPolynomial() {
assertTrue(18 == getEvaluator().getNumberResult("evalpolynomial('3x^2+4x-2','2')"));
assertTrue(3 == getEvaluator().getNumberResult("evalpolynomial('y^2+2y','1')"));
assertTrue(10 == getEvaluator().getNumberResult("evalpolynomial('2a+8','1')"));
assertTrue(4 == getEvaluator().getNumberResult("evalpolynomial('b^2-4b+8','2')"));
assertTrue(4 == getEvaluator().getNumberResult("evalpolynomial('b^2-4b+8','2')"));
}
@Test
public void testEvalPolynomialWithInput() {
assertTrue(3 == getEvaluator().getNumberResult("evalpolynomial('y^2+2y','[pos=2]')"));
}
@Test
public void testEvalPolynomialWithVariables() {
assertTrue(10 == getEvaluator().getNumberResult("evalpolynomial('[var=a]a+2a+8','1')"));
}
@Test
public void testEvalPolynomialWithDifferentVariableNamesInPolynom() {
assertTrue(2 == getEvaluator().getNumberResult("evalpolynomial('(x1)^2+(x2)^4', '1')"));
assertTrue(3 == getEvaluator().getNumberResult("evalpolynomial('(x)^2+(y)^4+(z)^5', '1')"));
assertTrue(3 == getEvaluator().getNumberResult("evalpolynomial('(a)^2+(b)^4+(c)^5', '1')"));
assertTrue(4 == getEvaluator().getNumberResult("evalpolynomial('(ü)^2', '2')"));
}
@Test(expected=InvalidCASFunctionArgumentException.class)
public void testEvalPolynomialWithCharacterAsSecondArgument() {
getEvaluator().getNumberResult("evalpolynomial('a+2a+8','a')");
}
@Test(expected=InvalidCASFunctionArgumentException.class)
public void testEvalPolynomialWithONECharacter() {
getEvaluator().getNumberResult("evalpolynomial(a, a)");
}
@Test(expected=InvalidCASFunctionArgumentException.class)
public void testEvalPolynomialWithEmptyStringArgument() {
getEvaluator().getNumberResult(("evalpolynomial('', '')"));
}
@Test(expected=InvalidCASFunctionArgumentException.class)
public void testEvalPolynomialWithEmptyArgument() {
getEvaluator().getNumberResult(("evalpolynomial()"));
}
@Test(expected=UndefinedExerciseVariableException.class)
public void testEvalPolynomialWithoutExerciseVariable() {
getEvaluator().getNumberResult("evalpolynomial([var=j], '3')");
}
@Test(expected=UndefinedFillInVariableException.class)
public void testEvalPolynomialWithoutInput() {
getEvaluator().getNumberResult("evalpolynomial([pos=42], '3')");
}