Ultra Geile Studenten Benutzer Oberfläche (UGSBO)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.1 KiB

  1. package com.ugsbo.complexnumcalc;
  2. import static org.junit.Assert.assertEquals;
  3. import org.junit.Test;
  4. public class AbsoluteValueOfComplexNumbersTest {
  5. @Test
  6. public void TheAbsoluteValueOfAComplexNumberWithOnlyARealPart_IsNotTHeAbsoluteValueOfTheRealPart() {
  7. ComplexNumber complexNumber = new ComplexNumber(Double.valueOf(4), Double.valueOf(0));
  8. Double expected = Double.valueOf(4);
  9. Double actual = complexNumber.absolutValueOf();
  10. assertEquals("The absolute value of an complex number with only an real part should be the absolute value of that real part", expected, actual);
  11. }
  12. @Test
  13. public void TheAbsoluteValueOfAComplexNumberWithOnlyANegativeRealPart_IsNotTheAbsoluteValueOfTheRealPart() {
  14. ComplexNumber complexNumber = new ComplexNumber(Double.valueOf(-4), Double.valueOf(0));
  15. Double expected = Double.valueOf(4);
  16. Double actual = complexNumber.absolutValueOf();
  17. assertEquals("The absolute value of an complex number with only an negative real part should be the absolute value of that real part", expected, actual);
  18. }
  19. }