File tree Expand file tree Collapse file tree 2 files changed +123
-119
lines changed
exercises/practice/complex-numbers Expand file tree Collapse file tree 2 files changed +123
-119
lines changed Original file line number Diff line number Diff line change 1+ { { func toarg
2+ case (object.typeof $0)
3+ when " array"
4+ ret $" new ComplexNumber({toarg $0[0]}, {toarg $0[1]})"
5+ when " string"
6+ str = string.replace $0 " ln(2)" " Math.Log(2.0)"
7+ str = string.replace str " pi" " Math.PI"
8+ str = string.replace str " e" " Math.E"
9+ ret str
10+ else
11+ ret $0
12+ end
13+ end } }
14+
15+ using System;
16+ using Xunit;
17+
18+ public class { { testClass } }
19+ {
20+ {{- for test in tests } }
21+ [Fact{ { if ! for.first } }(Skip = "Remove this Skip property to run this test"){ { end } }]
22+ public void { { test.shortTestMethod } }()
23+ {
24+ {{- if test.input.z1 } }
25+ var actual = { { test.input.z1 | toarg } }.{ { test.testedMethod } }({ { test.input.z2 | toarg } });
26+ Assert.Equal({ { test.expected[0] | toarg } }, actual.Real());
27+ Assert.Equal({ { test.expected[1] | toarg } }, actual.Imaginary());
28+ { {- else if test.input.z } }
29+ { {- if test.expected | object.typeof == " number" } }
30+ Assert.Equal({ { test.expected | toarg } }, { { test.input.z | toarg } }.{ { test.testedMethod } }());
31+ { {- else } }
32+ var actual = { { test.input.z | toarg } }.{ { test.testedMethod } }();
33+ Assert.Equal({ { test.expected[0] | toarg } }, actual.Real(){ { if test.property == " exp" } }, precision: 7{ { end } });
34+ Assert.Equal({ { test.expected[1] | toarg } }, actual.Imaginary(){ { if test.property == " exp" } }, precision: 7{ { end } });
35+ { { end -} }
36+ { { end -} }
37+ }
38+ { { end -} }
39+ }
You can’t perform that action at this time.
0 commit comments