206             {
  209    Complex num1(x1, y1), num2(x2, y2);
 
  213    
  215    expected = cnum1 + cnum2;
  216    assert(((void)"1 + 1i + 1 + 1i is equal to 2 + 2i but the addition doesn't "
  217                  "add up \n",
  221    
  223    expected = cnum1 - cnum2;
  224    assert(((void)"1 + 1i - 1 - 1i is equal to 0 but the program says "
  225                  "otherwise. \n",
  229    
  231    expected = cnum1 * cnum2;
  232    assert(((void)"(1 + 1i) * (1 + 1i) is equal to 2i but the program says "
  233                  "otherwise. \n",
  237    
  239    expected = cnum1 / cnum2;
  240    assert(((void)"(1 + 1i) / (1 + 1i) is equal to 1 but the program says "
  241                  "otherwise.\n",
  245    
  247    expected = std::conj(cnum1);
  248    assert(((void)"(1 + 1i) has a conjugate which is equal to (1 - 1i) but the "
  249                  "program says otherwise.\n",
  253    
  254    assert(((void)"(1 + 1i) has argument PI / 4 but the program differs from "
  255                  "the std::complex result.\n",
  256            (num1.arg() == std::arg(cnum1))));
  258    
  259    assert(((void)"(1 + 1i) has absolute value sqrt(2) but the program differs "
  260                  "from the std::complex result. \n",
  261            (num1.abs() == std::abs(cnum1))));
  263}
Class Complex to represent complex numbers as a field.
Definition: complex_numbers.cpp:20
double get_rand()
Function to get random numbers to generate our complex numbers for test.
Definition: complex_numbers.cpp:201
uint64_t result(uint64_t n)
Definition: fibonacci_sum.cpp:76