Skip to content

Commit

Permalink
SAK-44324 a few more unit tests to better understand tan function (sa…
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff authored Mar 25, 2021
1 parent fbb4561 commit dbda803
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,19 @@ public void testCalculationsToValues() throws SamigoExpressionError {
result = gradingService.processFormulaIntoValue("if(1>3, 5, 2)", 2);
Assert.assertNotNull(result);
Assert.assertEquals("2", result);

// tan is specified in radians by default
result = gradingService.processFormulaIntoValue("tan(40)", 2);
Assert.assertNotNull(result);
Assert.assertEquals("-1.12", result);
// use rad() to transform input from degrees before passing to tan()
result = gradingService.processFormulaIntoValue("tan(rad(40))", 2);
Assert.assertNotNull(result);
Assert.assertEquals("0.84", result);
// complex real example
result = gradingService.processFormulaIntoValue("1.5*((6^2*tan(rad(90-50))+4*6)*80)/27", 0);
Assert.assertNotNull(result);
Assert.assertEquals("241", result);
}

@Test(expected = SamigoExpressionError.class)
Expand Down

0 comments on commit dbda803

Please sign in to comment.