Skip to content

Commit 760dcc3

Browse files
committed
Running format.js
1 parent 5b4d1d9 commit 760dcc3

File tree

1 file changed

+64
-64
lines changed

1 file changed

+64
-64
lines changed

exercises/practice/complex-numbers/complex-numbers.spec.js

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ describe('Complex numbers', () => {
66
test('Real part of a purely real number', () => {
77
const expected = 1;
88
const actual = new ComplexNumber(1, 0).real;
9-
9+
1010
expect(actual).toEqual(expected);
1111
});
12-
12+
1313
xtest('Real part of a purely imaginary number', () => {
1414
const expected = 0;
1515
const actual = new ComplexNumber(0, 1).real;
16-
16+
1717
expect(actual).toEqual(expected);
1818
});
19-
19+
2020
xtest('Real part of a number with real and imaginary part', () => {
2121
const expected = 1;
2222
const actual = new ComplexNumber(1, 2).real;
23-
23+
2424
expect(actual).toEqual(expected);
2525
});
2626
});
@@ -29,21 +29,21 @@ describe('Complex numbers', () => {
2929
xtest('Imaginary part of a purely real number', () => {
3030
const expected = 0;
3131
const actual = new ComplexNumber(1, 0).imag;
32-
32+
3333
expect(actual).toEqual(expected);
3434
});
35-
35+
3636
xtest('Imaginary part of a purely imaginary number', () => {
3737
const expected = 1;
3838
const actual = new ComplexNumber(0, 1).imag;
39-
39+
4040
expect(actual).toEqual(expected);
4141
});
42-
42+
4343
xtest('Imaginary part of a number with real and imaginary part', () => {
4444
const expected = 2;
4545
const actual = new ComplexNumber(1, 2).imag;
46-
46+
4747
expect(actual).toEqual(expected);
4848
});
4949
});
@@ -59,84 +59,84 @@ describe('Complex numbers', () => {
5959
xtest('Add purely real numbers', () => {
6060
const expected = new ComplexNumber(3, 0);
6161
const actual = new ComplexNumber(1, 0).add(new ComplexNumber(2, 0));
62-
62+
6363
expect(actual).toEqual(expected);
6464
});
65-
65+
6666
xtest('Add purely imaginary numbers', () => {
6767
const expected = new ComplexNumber(0, 3);
6868
const actual = new ComplexNumber(0, 1).add(new ComplexNumber(0, 2));
69-
69+
7070
expect(actual).toEqual(expected);
7171
});
72-
72+
7373
xtest('Add numbers with real and imaginary part', () => {
7474
const expected = new ComplexNumber(4, 6);
7575
const actual = new ComplexNumber(1, 2).add(new ComplexNumber(3, 4));
76-
76+
7777
expect(actual).toEqual(expected);
7878
});
79-
79+
8080
xtest('Subtract purely real numbers', () => {
8181
const expected = new ComplexNumber(-1, 0);
8282
const actual = new ComplexNumber(1, 0).sub(new ComplexNumber(2, 0));
83-
83+
8484
expect(actual).toEqual(expected);
8585
});
86-
86+
8787
xtest('Subtract purely imaginary numbers', () => {
8888
const expected = new ComplexNumber(0, -1);
8989
const actual = new ComplexNumber(0, 1).sub(new ComplexNumber(0, 2));
90-
90+
9191
expect(actual).toEqual(expected);
9292
});
93-
93+
9494
xtest('Subtract numbers with real and imaginary part', () => {
9595
const expected = new ComplexNumber(-2, -2);
9696
const actual = new ComplexNumber(1, 2).sub(new ComplexNumber(3, 4));
97-
97+
9898
expect(actual).toEqual(expected);
9999
});
100-
100+
101101
xtest('Multiply purely real numbers', () => {
102102
const expected = new ComplexNumber(2, 0);
103103
const actual = new ComplexNumber(1, 0).mul(new ComplexNumber(2, 0));
104-
104+
105105
expect(actual).toEqual(expected);
106106
});
107-
107+
108108
xtest('Multiply purely imaginary numbers', () => {
109109
const expected = new ComplexNumber(-2, 0);
110110
const actual = new ComplexNumber(0, 1).mul(new ComplexNumber(0, 2));
111-
111+
112112
expect(actual).toEqual(expected);
113113
});
114-
114+
115115
xtest('Multiply numbers with real and imaginary part', () => {
116116
const expected = new ComplexNumber(-5, 10);
117117
const actual = new ComplexNumber(1, 2).mul(new ComplexNumber(3, 4));
118-
118+
119119
expect(actual).toEqual(expected);
120120
});
121-
121+
122122
xtest('Divide purely real numbers', () => {
123123
const expected = new ComplexNumber(0.5, 0);
124124
const actual = new ComplexNumber(1, 0).div(new ComplexNumber(2, 0));
125-
125+
126126
expect(actual).toEqual(expected);
127127
});
128-
128+
129129
xtest('Divide purely imaginary numbers', () => {
130130
const expected = new ComplexNumber(0.5, 0);
131131
const actual = new ComplexNumber(0, 1).div(new ComplexNumber(0, 2));
132-
132+
133133
expect(actual).toEqual(expected);
134134
});
135-
135+
136136
xtest('Divide numbers with real and imaginary part', () => {
137137
const expected = new ComplexNumber(0.44, 0.08);
138138
const actual = new ComplexNumber(1, 2).div(new ComplexNumber(3, 4));
139-
139+
140140
expect(actual).toEqual(expected);
141141
});
142142
});
@@ -145,35 +145,35 @@ describe('Complex numbers', () => {
145145
xtest('Absolute value of a positive purely real number', () => {
146146
const expected = 5;
147147
const actual = new ComplexNumber(5, 0).abs;
148-
148+
149149
expect(actual).toEqual(expected);
150150
});
151-
151+
152152
xtest('Absolute value of a negative purely real number', () => {
153153
const expected = 5;
154154
const actual = new ComplexNumber(-5, 0).abs;
155-
155+
156156
expect(actual).toEqual(expected);
157157
});
158-
158+
159159
xtest('Absolute value of a purely imaginary number with positive imaginary part', () => {
160160
const expected = 5;
161161
const actual = new ComplexNumber(0, 5).abs;
162-
162+
163163
expect(actual).toEqual(expected);
164164
});
165-
165+
166166
xtest('Absolute value of a purely imaginary number with negative imaginary part', () => {
167167
const expected = 5;
168168
const actual = new ComplexNumber(0, -5).abs;
169-
169+
170170
expect(actual).toEqual(expected);
171171
});
172-
172+
173173
xtest('Absolute value of a number with real and imaginary part', () => {
174174
const expected = 5;
175175
const actual = new ComplexNumber(3, 4).abs;
176-
176+
177177
expect(actual).toEqual(expected);
178178
});
179179
});
@@ -182,21 +182,21 @@ describe('Complex numbers', () => {
182182
xtest('Conjugate a purely real number', () => {
183183
const expected = new ComplexNumber(5, 0);
184184
const actual = new ComplexNumber(5, 0).conj;
185-
185+
186186
expect(actual).toEqual(expected);
187187
});
188-
188+
189189
xtest('Conjugate a purely imaginary number', () => {
190190
const expected = new ComplexNumber(0, -5);
191191
const actual = new ComplexNumber(0, 5).conj;
192-
192+
193193
expect(actual).toEqual(expected);
194194
});
195-
195+
196196
xtest('Conjugate a number with real and imaginary part', () => {
197197
const expected = new ComplexNumber(1, -1);
198198
const actual = new ComplexNumber(1, 1).conj;
199-
199+
200200
expect(actual).toEqual(expected);
201201
});
202202
});
@@ -205,39 +205,39 @@ describe('Complex numbers', () => {
205205
xtest("Euler's identity/formula", () => {
206206
const expected = new ComplexNumber(-1, 0);
207207
const actual = new ComplexNumber(0, Math.PI).exp;
208-
208+
209209
expect(actual.real).toBeCloseTo(expected.real);
210210
expect(actual.imag).toBeCloseTo(expected.imag);
211211
});
212-
212+
213213
xtest('Exponential of 0', () => {
214214
const expected = new ComplexNumber(1, 0);
215215
const actual = new ComplexNumber(0, 0).exp;
216-
216+
217217
expect(actual.real).toBeCloseTo(expected.real);
218218
expect(actual.imag).toBeCloseTo(expected.imag);
219219
});
220-
220+
221221
xtest('Exponential of a purely real number', () => {
222222
const expected = new ComplexNumber(Math.E, 0);
223223
const actual = new ComplexNumber(1, 0).exp;
224-
224+
225225
expect(actual.real).toBeCloseTo(expected.real);
226226
expect(actual.imag).toBeCloseTo(expected.imag);
227227
});
228-
228+
229229
xtest('Exponential of a number with real and imaginary part', () => {
230230
const expected = new ComplexNumber(-2, 0);
231231
const actual = new ComplexNumber(Math.LN2, Math.PI).exp;
232-
232+
233233
expect(actual.real).toBeCloseTo(expected.real);
234234
expect(actual.imag).toBeCloseTo(expected.imag);
235235
});
236236

237237
xtest('Exponential resulting in a number with real and imaginary part', () => {
238238
const expected = new ComplexNumber(1, 1);
239239
const actual = new ComplexNumber(Math.LN2 / 2, Math.PI / 4).exp;
240-
240+
241241
expect(actual.real).toBeCloseTo(expected.real);
242242
expect(actual.imag).toBeCloseTo(expected.imag);
243243
});
@@ -247,63 +247,63 @@ describe('Complex numbers', () => {
247247
xtest('Add real number to complex number', () => {
248248
const expected = new ComplexNumber(6, 2);
249249
const actual = new ComplexNumber(1, 2).add(new ComplexNumber(5, 0));
250-
250+
251251
expect(actual.real).toBeCloseTo(expected.real);
252252
expect(actual.imag).toBeCloseTo(expected.imag);
253253
});
254254

255255
xtest('Add complex number to real number', () => {
256256
const expected = new ComplexNumber(6, 2);
257257
const actual = new ComplexNumber(5, 0).add(new ComplexNumber(1, 2));
258-
258+
259259
expect(actual.real).toBeCloseTo(expected.real);
260260
expect(actual.imag).toBeCloseTo(expected.imag);
261261
});
262262

263263
xtest('Subtract real number from complex number', () => {
264264
const expected = new ComplexNumber(1, 7);
265265
const actual = new ComplexNumber(5, 7).sub(new ComplexNumber(4, 0));
266-
266+
267267
expect(actual.real).toBeCloseTo(expected.real);
268268
expect(actual.imag).toBeCloseTo(expected.imag);
269269
});
270-
270+
271271
xtest('Subtract complex number from real number', () => {
272272
const expected = new ComplexNumber(-1, -7);
273273
const actual = new ComplexNumber(4, 0).sub(new ComplexNumber(5, 7));
274-
274+
275275
expect(actual.real).toBeCloseTo(expected.real);
276276
expect(actual.imag).toBeCloseTo(expected.imag);
277277
});
278278

279279
xtest('Multiply complex number by real number', () => {
280280
const expected = new ComplexNumber(10, 25);
281281
const actual = new ComplexNumber(2, 5).mul(new ComplexNumber(5, 0));
282-
282+
283283
expect(actual.real).toBeCloseTo(expected.real);
284284
expect(actual.imag).toBeCloseTo(expected.imag);
285285
});
286286

287287
xtest('Multiply real number by complex number', () => {
288288
const expected = new ComplexNumber(10, 25);
289289
const actual = new ComplexNumber(5, 0).mul(new ComplexNumber(2, 5));
290-
290+
291291
expect(actual.real).toBeCloseTo(expected.real);
292292
expect(actual.imag).toBeCloseTo(expected.imag);
293293
});
294294

295295
xtest('Divide complex number by real number', () => {
296296
const expected = new ComplexNumber(1, 10);
297297
const actual = new ComplexNumber(10, 100).div(new ComplexNumber(10, 0));
298-
298+
299299
expect(actual.real).toBeCloseTo(expected.real);
300300
expect(actual.imag).toBeCloseTo(expected.imag);
301301
});
302302

303303
xtest('Divide real number by complex number', () => {
304304
const expected = new ComplexNumber(2.5, -2.5);
305305
const actual = new ComplexNumber(5, 0).div(new ComplexNumber(1, 1));
306-
306+
307307
expect(actual.real).toBeCloseTo(expected.real);
308308
expect(actual.imag).toBeCloseTo(expected.imag);
309309
});

0 commit comments

Comments
 (0)