content: import 'package:scidart/numdart.dart';
  import 'package:scidart/scidart.dart';
  import 'package:test/test.dart';
  
  void main() {
    test('fft of a signal', () {
      var x =
          arrayToComplexArray(Array([1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0]));
  
      var X = fft(x);
  
      // expected FFT calulated with Scipy (from scipy.fftpack import fft, ifft)
      var XExpected = [
        Complex(real: 4.0, imaginary: 0.0),
        Complex(real: 1.0, imaginary: -2.41421356),
        Complex(real: 0.0, imaginary: 0.0),
        Complex(real: 1.0, imaginary: -0.41421356),
        Complex(real: 0.0, imaginary: 0.0),
        Complex(real: 1.0, imaginary: 0.41421356),
        Complex(real: 0.0, imaginary: 0.0),
        Complex(real: 1.0, imaginary: 2.41421356)
      ];
  
      var fractionDigits = 8;
      for (var i = 0; i < X.length; i++) {
        expect(truncate(X[i].real, fractionDigits),
            truncate(XExpected[i].real, fractionDigits));
        expect(truncate(X[i].imaginary, fractionDigits),
            truncate(XExpected[i].imaginary, fractionDigits));
      }
    });
  
    test('fft of an odd samples signal', () {
      var x = arrayToComplexArray(Array([1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0]));
  
      var X = fft(x);
  
      print(X);
  
      // expected FFT
      var XExpected = ArrayComplex([
        Complex(real: 4.0, imaginary: 0.0),
        Complex(real: 0.5, imaginary: -2.19064313),
        Complex(real: 0.5, imaginary: 0.24078731),
        Complex(real: 0.5, imaginary: -0.62698017),
        Complex(real: 0.5, imaginary: 0.62698017),
        Complex(real: 0.5, imaginary: -0.24078731),
        Complex(real: 0.5, imaginary: 2.19064313)
      ]);
  
      var fractionDigits = 8;
      for (var i = 0; i < X.length; i++) {
        expect(truncate(X[i].real, fractionDigits),
            truncate(XExpected[i].real, fractionDigits));
        expect(truncate(X[i].imaginary, fractionDigits),
            truncate(XExpected[i].imaginary, fractionDigits));
      }
    });
  
    test('fft of signal with a N < length defined', () {
      var x = arrayToComplexArray(Array([1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0]));
  
      var X = fft(x, n: 6);
  
      print(X);
  
      // expected FFT
      var XExpected = ArrayComplex([
        Complex(real: 4.0, imaginary: 0.0),
        Complex(real: 2.220446049250313e-16, imaginary: -1.7320508075688776),
        Complex(real: 0.9999999999999998, imaginary: -1.9915985002059197e-16),
        Complex(real: 0.0, imaginary: -2.449293598294706e-16),
        Complex(real: 1.0000000000000004, imaginary: -2.872973975786683e-16),
        Complex(real: 2.220446049250313e-16, imaginary: 1.7320508075688748)
      ]);
  
      var fractionDigits = 8;
      for (var i = 0; i < X.length; i++) {
        expect(truncate(X[i].real, fractionDigits),
            truncate(XExpected[i].real, fractionDigits));
        expect(truncate(X[i].imaginary, fractionDigits),
            truncate(XExpected[i].imaginary, fractionDigits));
      }
    });
  
    test('fft of signal with a N > length defined', () {
      var x = arrayToComplexArray(Array([1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0]));
  
      var X = fft(x, n: 16, forceDft: true);
  
      // expected FFT
      var XExpected = ArrayComplex([
        Complex(real: 4.0, imaginary: 0.0),
        Complex(real: -2.0137, imaginary: 3.0137),
        Complex(real: -1.0, imaginary: -2.4142),
        Complex(real: 1.2483, imaginary: 0.2483),
        Complex(real: 0.0, imaginary: 0.0),
        Complex(real: 0.1659, imaginary: 0.8341),
        Complex(real: -1.0, imaginary: -0.4142),
        Complex(real: 0.5995, imaginary: -0.4005),
        Complex(real: 0.0, imaginary: 0.0),
        Complex(real: 0.5995, imaginary: 0.4005),
        Complex(real: -1.0, imaginary: 0.4142),
        Complex(real: 0.1659, imaginary: -0.8341),
        Complex(real: 0.0, imaginary: 0.0),
        Complex(real: 1.2483, imaginary: -0.2483),
        Complex(real: -1.0, imaginary: 2.4142),
        Complex(real: -2.0137, imaginary: -3.0137)
      ]);
  
      arrayComplexTruncateEachElement(X, 4);
      arrayComplexTruncateEachElement(XExpected, 4);
  
      print(X);
  
      expect(X, XExpected);
    });
  
    test('fft of a big signal', () {
      var x = arrayToComplexArray(Array([
        0.89968999,
        0.89968999,
        0.89968999,
        0.89968999,
        0.89968999,
        0.61548992,
        0.89968999,
        0.61548992,
        0.61548992,
        0.33128984,
        0.33128984,
        0.047089768,
        0.047089768,
        0.33128984,
        0.33128984,
        0.33128984,
        0.61548992,
        0.89968999,
        1.1838901,
        0.61548992,
        0.047089768,
        -0.23711031,
        0.047089768,
        0.89968999,
        0.33128984,
        -1.3739106,
        -1.3739106,
        -1.3739106,
        -0.23711031,
        0.047089768,
        0.61548992,
        0.61548992,
        -0.52131038,
        -1.6581107,
        -2.2265108,
        -1.9423108,
        -0.80551046,
        -0.52131038,
        0.33128984,
        0.33128984,
        0.61548992,
        0.33128984,
        0.047089768,
        -0.23711031,
        -0.23711031,
        -0.52131038,
        -0.80551046,
        -0.80551046,
        -0.52131038,
        -0.52131038,
        -0.52131038,
        -0.23711031,
        -0.52131038,
        -0.23711031,
        -0.23711031,
        -0.23711031,
        -0.52131038,
        -0.52131038,
        -0.52131038,
        -0.52131038,
        0.047089768,
        0.33128984,
        0.89968999,
        0.33128984,
        0.89968999,
        0.89968999,
        -0.23711031,
        -0.80551046,
        -0.80551046,
        0.047089768,
        1.1838901,
        1.4680901,
        0.89968999,
        -0.52131038,
        -0.80551046,
        -0.52131038,
        -0.23711031,
        0.047089768,
        -0.23711031,
        -0.52131038,
        -0.52131038,
        0.047089768,
        0.047089768,
        0.33128984,
        0.047089768,
        0.047089768,
        0.047089768,
        0.047089768,
        0.047089768,
        0.047089768,
        -0.23711031,
        -0.23711031,
        0.047089768,
        0.047089768,
        0.33128984,
        0.047089768,
        -0.23711031,
        -0.23711031,
        0.047089768,
        0.89968999,
        0.89968999,
        1.1838901,
        0.61548992,
        -0.23711031,
        0.047089768,
        -0.23711031,
        -0.23711031,
        -0.23711031,
        -0.23711031,
        -0.52131038,
        -0.52131038,
        -1.9423108,
        -2.2265108,
        -2.5107109,
        -1.6581107,
        -0.52131038,
        0.33128984,
        1.4680901,
        1.1838901,
        0.61548992,
        -0.23711031,
        -0.52131038,
        -0.52131038,
        -0.52131038,
        -0.52131038,
        0.047089768,
        0.047089768,
        0.047089768,
        -0.23711031,
        -0.52131038,
        -0.80551046,
        -0.80551046,
        -0.23711031,
        0.047089768,
        0.047089768,
        -0.23711031,
        -0.23711031,
        -0.23711031,
        -0.23711031,
        0.047089768,
        0.33128984,
        0.33128984,
        1.7522902,
        0.89968999,
        0.33128984,
        0.33128984,
        -0.80551046,
        -0.80551046,
        -1.0897105,
        -0.23711031,
        0.61548992,
        0.61548992,
        -0.23711031,
        -0.80551046,
        -1.0897105,
        -0.80551046,
        -0.23711031,
        0.047089768,
        0.047089768,
        0.047089768,
        -0.23711031,
        0.33128984,
        0.61548992,
        0.61548992,
        0.61548992,
        0.33128984,
        0.33128984,
        0.33128984,
        0.047089768,
        0.047089768,
        -0.23711031,
        -0.23711031,
        0.047089768,
        0.047089768,
        0.047089768,
        0.047089768,
        -0.23711031,
        0.047089768,
        0.33128984,
        0.61548992,
        0.61548992,
        0.89968999,
        0.33128984,
        -0.52131038,
        0.33128984,
        -0.23711031,
        -0.23711031,
        -0.23711031,
        -0.23711031,
        -0.23711031,
        -0.52131038,
        -1.3739106,
        -2.2265108,
        -2.794911,
        -2.2265108,
        -0.80551046,
        0.89968999,
        1.4680901,
        1.1838901,
        0.33128984,
        -0.23711031,
        -0.23711031,
        -0.80551046,
        -1.0897105,
        -0.52131038,
        0.047089768,
        0.61548992,
        0.61548992,
        0.33128984,
        0.047089768,
        -0.23711031,
        -0.23711031,
        -0.23711031,
        -0.23711031,
        0.047089768,
        0.33128984,
        0.89968999,
        0.89968999,
        1.1838901,
        0.89968999,
        -0.23711031,
        0.047089768,
        2.0364903,
        2.3206904,
        0.61548992,
        -0.52131038,
        -1.0897105,
        -0.52131038,
        0.33128984,
        0.61548992,
        -0.23711031,
        -0.80551046,
        -1.6581107,
        -1.9423108,
        -1.0897105,
        -0.52131038,
        -0.23711031,
        -0.52131038,
        -0.23711031,
        0.047089768,
        0.33128984,
        0.89968999,
        0.61548992,
        0.89968999,
        0.61548992,
        0.61548992,
        0.61548992,
        0.61548992,
        0.61548992,
        0.33128984,
        0.33128984,
        0.33128984,
        0.33128984,
        0.047089768,
        0.33128984,
        0.33128984
      ]));
  
      var X = fft(x);
  
      print(X[0]);
  
      // expected FFT calulated with Scipy (from scipy.fftpack import fft, ifft)
      var XExpected = [
        Complex(real: -7.2706245379999945, imaginary: -0.0),
        Complex(real: 17.688394974740685, imaginary: 7.275213271480358),
        Complex(real: 14.120047630917174, imaginary: 6.361267016073613),
        Complex(real: 28.37647051041825, imaginary: 11.830537266054224),
        Complex(real: 4.841883735630235, imaginary: -18.28920615441661),
        Complex(real: 10.344190197471384, imaginary: -20.160543381463764),
        Complex(real: 22.43984336486661, imaginary: -17.42388018195262),
        Complex(real: 4.384848470483732, imaginary: 23.22026097596188),
        Complex(real: 2.3110203675488625, imaginary: 4.588346542143563),
        Complex(real: -14.303699178566715, imaginary: -0.14920945594779056),
        Complex(real: -14.203309243254079, imaginary: 22.892759309038713),
        Complex(real: -3.70694138133151, imaginary: 3.1687953058901046),
        Complex(real: -18.218256703482417, imaginary: 6.384085649861481),
        Complex(real: 16.428507770099603, imaginary: -44.683013396094736),
        Complex(real: 4.901413885338185, imaginary: -0.25541807422683604),
        Complex(real: 10.323567588055434, imaginary: -2.096980139790799),
        Complex(real: -9.985851991485113, imaginary: -15.132729183318778),
        Complex(real: 12.710478214811701, imaginary: 3.681595155636682),
        Complex(real: 12.191017508347112, imaginary: -5.542068709200773),
        Complex(real: -1.5536281876373188, imaginary: 4.617777565795096),
        Complex(real: -1.2354021237492814, imaginary: -16.059497313266064),
        Complex(real: -9.329208019655422, imaginary: -8.037338928060286),
        Complex(real: 7.1786206817607905, imaginary: -8.318684546009827),
        Complex(real: -22.666974501659745, imaginary: 28.820245503367467),
        Complex(real: -3.7859437296223306, imaginary: 11.01961038005904),
        Complex(real: 3.4412069669841965, imaginary: -6.70678344042792),
        Complex(real: 22.56028817511134, imaginary: -18.14227714253225),
        Complex(real: 3.0031230126415704, imaginary: -1.682636429953594),
        Complex(real: -9.440595649647108, imaginary: 16.95748705095749),
        Complex(real: -8.383885792046748, imaginary: -32.23171005549956),
        Complex(real: -2.1968343343910997, imaginary: 6.15667353880897),
        Complex(real: 12.067915143683358, imaginary: 1.0986139628753238),
        Complex(real: -2.7444787212246355, imaginary: 42.19462725373097),
        Complex(real: 7.873968199475052, imaginary: -12.73100980137999),
        Complex(real: -0.18144228665794981, imaginary: -11.23554495701747),
        Complex(real: -1.975709148914402, imaginary: -2.23533000507493),
        Complex(real: 3.0369856562978508, imaginary: -16.738262550938046),
        Complex(real: -3.731064150158476, imaginary: -12.633038757771129),
        Complex(real: -3.263617012247226, imaginary: -12.59389371810262),
        Complex(real: 8.440304778331557, imaginary: 17.833451507023995),
        Complex(real: 4.558112576183337, imaginary: 17.414184412641255),
        Complex(real: 0.33061580254649936, imaginary: 7.996976886568499),
        Complex(real: -10.33385961246727, imaginary: 9.608124196249463),
        Complex(real: 1.4655656702505258, imaginary: -1.1952357394888675),
        Complex(real: 5.951027787029995, imaginary: -10.46064371845706),
        Complex(real: -15.838144031882287, imaginary: -16.07388480687634),
        Complex(real: 11.763559024772508, imaginary: -7.4146256891464155),
        Complex(real: 13.177379158377569, imaginary: -3.1039091520755937),
        Complex(real: -0.7153232065559361, imaginary: 3.0358369566647525),
        Complex(real: -9.00107137546984, imaginary: 4.4903942944471416),
        Complex(real: -6.418618299700006, imaginary: 3.9243574258939664),
        Complex(real: 1.427965283519149, imaginary: -3.8656399369734036),
        Complex(real: -1.8166401205571803, imaginary: -0.1722791174810876),
        Complex(real: -3.072796018474566, imaginary: 1.9328207760930618),
        Complex(real: 7.5233660701337595, imaginary: 2.214715652553716),
        Complex(real: 4.069994484877551, imaginary: 0.7426460723115833),
        Complex(real: 5.643967057281076, imaginary: 3.7405069015940087),
        Complex(real: -1.5630065377692053, imaginary: 1.609110372286894),
        Complex(real: 0.08803196082693798, imaginary: -2.97312927406204),
        Complex(real: -3.001657563115718, imaginary: -7.338644835519542),
        Complex(real: -2.0032836973144574, imaginary: -8.514058657604751),
        Complex(real: 3.0130848550612264, imaginary: 0.7824302790793487),
        Complex(real: -0.7697980969816571, imaginary: 4.1018157553154975),
        Complex(real: 3.8145815296763734, imaginary: 6.034537697325365),
        Complex(real: -2.273600838, imaginary: 1.705200507999999),
        Complex(real: 2.129640797356757, imaginary: 2.613856244634184),
        Complex(real: -2.1255479475165675, imaginary: 0.9091838557507967),
        Complex(real: -0.5130811179253048, imaginary: -3.6008558210695893),
        Complex(real: 1.9153438836399692, imaginary: -3.6487056397160504),
        Complex(real: -0.08783261611032822, imaginary: 0.4311381036149107),
        Complex(real: 0.8415441632417648, imaginary: 1.8383542421775525),
        Complex(real: -0.995313585455913, imaginary: 2.7019186547249348),
        Complex(real: -0.7649352471099475, imaginary: 0.08078775316698339),
        Complex(real: -4.157863481016978, imaginary: 1.5218763087151623),
        Complex(real: 0.6740173211799441, imaginary: -1.2900712920367532),
        Complex(real: 5.295738401782078, imaginary: 1.6797805499613614),
        Complex(real: 4.403497932546257, imaginary: -1.0791801191873365),
        Complex(real: -2.044409749309655, imaginary: 1.740935237493476),
        Complex(real: -1.0027514421578982, imaginary: 0.5820277708207899),
        Complex(real: 1.5706783156890958, imaginary: 1.0428950728472557),
        Complex(real: -3.7914827492403353, imaginary: -1.9418472901896318),
        Complex(real: -0.5937070864773384, imaginary: -4.107849232847365),
        Complex(real: -0.009964526642434635, imaginary: -2.711226695349225),
        Complex(real: 3.452459933058859, imaginary: 0.43424993201800444),
        Complex(real: -0.31264291848120207, imaginary: -0.5859488141487512),
        Complex(real: 1.438552389828797, imaginary: 1.6597649691955512),
        Complex(real: 1.8977905489060678, imaginary: 4.404420125070842),
        Complex(real: -2.8954666493718753, imaginary: -2.206337733392614),
        Complex(real: -0.5952138094094424, imaginary: -1.146120863274879),
        Complex(real: 0.7221407453131028, imaginary: -3.089399110563158),
        Complex(real: 1.0770008226371357, imaginary: 2.164687484162312),
        Complex(real: -2.078042049161473, imaginary: -2.0341691089367595),
        Complex(real: 3.1056010308987836, imaginary: -2.9756787555664985),
        Complex(real: -1.87008193318819, imaginary: 2.332650477663895),
        Complex(real: -1.5138361967562544, imaginary: -1.879869322013083),
        Complex(real: -0.9906932544806297, imaginary: 3.4390457201764795),
        Complex(real: 0.47087817322463654, imaginary: -4.414184810269031),
        Complex(real: -0.8124871883437779, imaginary: 1.0403563021418707),
        Complex(real: 0.9073566272720052, imaginary: 2.1775662585419244),
        Complex(real: 3.329331841526753, imaginary: -2.4720681209796815),
        Complex(real: 1.4612538773313495, imaginary: 0.8181404605827272),
        Complex(real: 1.9265264117729504, imaginary: -4.160458016236196),
        Complex(real: -2.6996204813567477, imaginary: -1.4298040614836864),
        Complex(real: 4.472527446446735, imaginary: -3.8785233815854205),
        Complex(real: -2.39342841979609, imaginary: 2.633380614787434),
        Complex(real: -4.155524497657506, imaginary: 0.1704580179438011),
        Complex(real: 0.8748931857634505, imaginary: 3.334186859791047),
        Complex(real: 1.2027622328697651, imaginary: 0.8465789411783966),
        Complex(real: 0.6972588959043835, imaginary: 0.36311839670671553),
        Complex(real: -2.899076848428317, imaginary: 0.03534542198014412),
        Complex(real: -0.03375857905161439, imaginary: -1.549159422528867),
        Complex(real: -0.020754780677191498, imaginary: 1.3056481173873928),
        Complex(real: -2.5593462287186144, imaginary: -5.332009374173163),
        Complex(real: -2.139928337969634, imaginary: 0.31195012806558053),
        Complex(real: 1.9945355886015674, imaginary: -0.18280448860222387),
        Complex(real: 0.5957454482502165, imaginary: 0.10262675747965488),
        Complex(real: 1.8268431524005688, imaginary: 0.8186825248314418),
        Complex(real: 2.602441844369606, imaginary: -2.1301419890352182),
        Complex(real: -1.6722483223639868, imaginary: 3.6367727947723942),
        Complex(real: 0.5677371353191276, imaginary: -0.7050139489315659),
        Complex(real: 1.8472229649245397, imaginary: 2.0083004083610674),
        Complex(real: 3.4370532510249836, imaginary: -2.7075399391269706),
        Complex(real: -1.152334122149755, imaginary: 0.6453790585208594),
        Complex(real: 0.4874795087675432, imaginary: -0.30960022062566495),
        Complex(real: 1.239924461552262, imaginary: 0.03420746873752201),
        Complex(real: -0.7882045463811576, imaginary: 3.379930454154806),
        Complex(real: 0.2050296240181817, imaginary: 1.493334441166152),
        Complex(real: 2.312494493755435, imaginary: 1.2870679218844456),
        Complex(real: 3.4104014220000014, imaginary: -0.0),
        Complex(real: 2.312494493755435, imaginary: -1.2870679218844456),
        Complex(real: 0.2050296240181817, imaginary: -1.493334441166152),
        Complex(real: -0.7882045463811576, imaginary: -3.379930454154806),
        Complex(real: 1.239924461552262, imaginary: -0.03420746873752201),
        Complex(real: 0.4874795087675432, imaginary: 0.30960022062566495),
        Complex(real: -1.152334122149755, imaginary: -0.6453790585208594),
        Complex(real: 3.4370532510249836, imaginary: 2.7075399391269706),
        Complex(real: 1.8472229649245397, imaginary: -2.0083004083610674),
        Complex(real: 0.5677371353191276, imaginary: 0.7050139489315659),
        Complex(real: -1.6722483223639868, imaginary: -3.6367727947723942),
        Complex(real: 2.602441844369606, imaginary: 2.1301419890352182),
        Complex(real: 1.8268431524005688, imaginary: -0.8186825248314418),
        Complex(real: 0.5957454482502165, imaginary: -0.10262675747965488),
        Complex(real: 1.9945355886015674, imaginary: 0.18280448860222387),
        Complex(real: -2.139928337969634, imaginary: -0.31195012806558053),
        Complex(real: -2.5593462287186144, imaginary: 5.332009374173163),
        Complex(real: -0.020754780677191498, imaginary: -1.3056481173873928),
        Complex(real: -0.03375857905161439, imaginary: 1.549159422528867),
        Complex(real: -2.899076848428317, imaginary: -0.03534542198014412),
        Complex(real: 0.6972588959043835, imaginary: -0.36311839670671553),
        Complex(real: 1.2027622328697651, imaginary: -0.8465789411783966),
        Complex(real: 0.8748931857634505, imaginary: -3.334186859791047),
        Complex(real: -4.155524497657506, imaginary: -0.1704580179438011),
        Complex(real: -2.39342841979609, imaginary: -2.633380614787434),
        Complex(real: 4.472527446446735, imaginary: 3.8785233815854205),
        Complex(real: -2.6996204813567477, imaginary: 1.4298040614836864),
        Complex(real: 1.9265264117729504, imaginary: 4.160458016236196),
        Complex(real: 1.4612538773313495, imaginary: -0.8181404605827272),
        Complex(real: 3.329331841526753, imaginary: 2.4720681209796815),
        Complex(real: 0.9073566272720052, imaginary: -2.1775662585419244),
        Complex(real: -0.8124871883437779, imaginary: -1.0403563021418707),
        Complex(real: 0.47087817322463654, imaginary: 4.414184810269031),
        Complex(real: -0.9906932544806297, imaginary: -3.4390457201764795),
        Complex(real: -1.5138361967562544, imaginary: 1.879869322013083),
        Complex(real: -1.87008193318819, imaginary: -2.332650477663895),
        Complex(real: 3.1056010308987836, imaginary: 2.9756787555664985),
        Complex(real: -2.078042049161473, imaginary: 2.0341691089367595),
        Complex(real: 1.0770008226371357, imaginary: -2.164687484162312),
        Complex(real: 0.7221407453131028, imaginary: 3.089399110563158),
        Complex(real: -0.5952138094094424, imaginary: 1.146120863274879),
        Complex(real: -2.8954666493718753, imaginary: 2.206337733392614),
        Complex(real: 1.8977905489060678, imaginary: -4.404420125070842),
        Complex(real: 1.438552389828797, imaginary: -1.6597649691955512),
        Complex(real: -0.31264291848120207, imaginary: 0.5859488141487512),
        Complex(real: 3.452459933058859, imaginary: -0.43424993201800444),
        Complex(real: -0.009964526642434635, imaginary: 2.711226695349225),
        Complex(real: -0.5937070864773384, imaginary: 4.107849232847365),
        Complex(real: -3.7914827492403353, imaginary: 1.9418472901896318),
        Complex(real: 1.5706783156890958, imaginary: -1.0428950728472557),
        Complex(real: -1.0027514421578982, imaginary: -0.5820277708207899),
        Complex(real: -2.044409749309655, imaginary: -1.740935237493476),
        Complex(real: 4.403497932546257, imaginary: 1.0791801191873365),
        Complex(real: 5.295738401782078, imaginary: -1.6797805499613614),
        Complex(real: 0.6740173211799441, imaginary: 1.2900712920367532),
        Complex(real: -4.157863481016978, imaginary: -1.5218763087151623),
        Complex(real: -0.7649352471099475, imaginary: -0.08078775316698339),
        Complex(real: -0.995313585455913, imaginary: -2.7019186547249348),
        Complex(real: 0.8415441632417648, imaginary: -1.8383542421775525),
        Complex(real: -0.08783261611032822, imaginary: -0.4311381036149107),
        Complex(real: 1.9153438836399692, imaginary: 3.6487056397160504),
        Complex(real: -0.5130811179253048, imaginary: 3.6008558210695893),
        Complex(real: -2.1255479475165675, imaginary: -0.9091838557507967),
        Complex(real: 2.129640797356757, imaginary: -2.613856244634184),
        Complex(real: -2.273600838, imaginary: -1.705200507999999),
        Complex(real: 3.8145815296763734, imaginary: -6.034537697325365),
        Complex(real: -0.7697980969816571, imaginary: -4.1018157553154975),
        Complex(real: 3.0130848550612264, imaginary: -0.7824302790793487),
        Complex(real: -2.0032836973144574, imaginary: 8.514058657604751),
        Complex(real: -3.001657563115718, imaginary: 7.338644835519542),
        Complex(real: 0.08803196082693798, imaginary: 2.97312927406204),
        Complex(real: -1.5630065377692053, imaginary: -1.609110372286894),
        Complex(real: 5.643967057281076, imaginary: -3.7405069015940087),
        Complex(real: 4.069994484877551, imaginary: -0.7426460723115833),
        Complex(real: 7.5233660701337595, imaginary: -2.214715652553716),
        Complex(real: -3.072796018474566, imaginary: -1.9328207760930618),
        Complex(real: -1.8166401205571803, imaginary: 0.1722791174810876),
        Complex(real: 1.427965283519149, imaginary: 3.8656399369734036),
        Complex(real: -6.418618299700006, imaginary: -3.9243574258939664),
        Complex(real: -9.00107137546984, imaginary: -4.4903942944471416),
        Complex(real: -0.7153232065559361, imaginary: -3.0358369566647525),
        Complex(real: 13.177379158377569, imaginary: 3.1039091520755937),
        Complex(real: 11.763559024772508, imaginary: 7.4146256891464155),
        Complex(real: -15.838144031882287, imaginary: 16.07388480687634),
        Complex(real: 5.951027787029995, imaginary: 10.46064371845706),
        Complex(real: 1.4655656702505258, imaginary: 1.1952357394888675),
        Complex(real: -10.33385961246727, imaginary: -9.608124196249463),
        Complex(real: 0.33061580254649936, imaginary: -7.996976886568499),
        Complex(real: 4.558112576183337, imaginary: -17.414184412641255),
        Complex(real: 8.440304778331557, imaginary: -17.833451507023995),
        Complex(real: -3.263617012247226, imaginary: 12.59389371810262),
        Complex(real: -3.731064150158476, imaginary: 12.633038757771129),
        Complex(real: 3.0369856562978508, imaginary: 16.738262550938046),
        Complex(real: -1.975709148914402, imaginary: 2.23533000507493),
        Complex(real: -0.18144228665794981, imaginary: 11.23554495701747),
        Complex(real: 7.873968199475052, imaginary: 12.73100980137999),
        Complex(real: -2.7444787212246355, imaginary: -42.19462725373097),
        Complex(real: 12.067915143683358, imaginary: -1.0986139628753238),
        Complex(real: -2.1968343343910997, imaginary: -6.15667353880897),
        Complex(real: -8.383885792046748, imaginary: 32.23171005549956),
        Complex(real: -9.440595649647108, imaginary: -16.95748705095749),
        Complex(real: 3.0031230126415704, imaginary: 1.682636429953594),
        Complex(real: 22.56028817511134, imaginary: 18.14227714253225),
        Complex(real: 3.4412069669841965, imaginary: 6.70678344042792),
        Complex(real: -3.7859437296223306, imaginary: -11.01961038005904),
        Complex(real: -22.666974501659745, imaginary: -28.820245503367467),
        Complex(real: 7.1786206817607905, imaginary: 8.318684546009827),
        Complex(real: -9.329208019655422, imaginary: 8.037338928060286),
        Complex(real: -1.2354021237492814, imaginary: 16.059497313266064),
        Complex(real: -1.5536281876373188, imaginary: -4.617777565795096),
        Complex(real: 12.191017508347112, imaginary: 5.542068709200773),
        Complex(real: 12.710478214811701, imaginary: -3.681595155636682),
        Complex(real: -9.985851991485113, imaginary: 15.132729183318778),
        Complex(real: 10.323567588055434, imaginary: 2.096980139790799),
        Complex(real: 4.901413885338185, imaginary: 0.25541807422683604),
        Complex(real: 16.428507770099603, imaginary: 44.683013396094736),
        Complex(real: -18.218256703482417, imaginary: -6.384085649861481),
        Complex(real: -3.70694138133151, imaginary: -3.1687953058901046),
        Complex(real: -14.203309243254079, imaginary: -22.892759309038713),
        Complex(real: -14.303699178566715, imaginary: 0.14920945594779056),
        Complex(real: 2.3110203675488625, imaginary: -4.588346542143563),
        Complex(real: 4.384848470483732, imaginary: -23.22026097596188),
        Complex(real: 22.43984336486661, imaginary: 17.42388018195262),
        Complex(real: 10.344190197471384, imaginary: 20.160543381463764),
        Complex(real: 4.841883735630235, imaginary: 18.28920615441661),
        Complex(real: 28.37647051041825, imaginary: -11.830537266054224),
        Complex(real: 14.120047630917174, imaginary: -6.361267016073613),
        Complex(real: 17.688394974740685, imaginary: -7.275213271480358),
      ];
  
      var fractionDigits = 8;
      for (var i = 0; i < X.length; i++) {
        expect(truncate(X[i].real, fractionDigits),
            truncate(XExpected[i].real, fractionDigits));
        expect(truncate(X[i].imaginary, fractionDigits),
            truncate(XExpected[i].imaginary, fractionDigits));
      }
    });
  }
  