@@ -6,81 +6,81 @@ using namespace chowdsp::wdft;
66
77TEST_CASE (" Combined Component Test" )
88{
9- // SECTION ("Resistor/Capacitor Series")
10- // {
11- // static constexpr auto r_val = 2000.0f;
12- // static constexpr auto c_val = 2.0e-6f;
13- //
14- // ResistorT<float> r1 { r_val };
15- // CapacitorT<float> c1 { c_val };
16- // WDFSeriesT<float, decltype (r1), decltype (c1)> s1 { r1, c1 };
17- //
18- // ResistorCapacitorSeriesT<float> rc1 { r_val, c_val };
19- //
20- // float inputs[] = { 0.0f, 1.0f, -1.0f, 2.0f, -3.0f };
21- // for (auto& a : inputs)
22- // {
23- // s1.incident (a);
24- // const auto ref = s1.reflected();
25- //
26- // rc1.incident (a);
27- // const auto actual = rc1.reflected();
28- //
29- // REQUIRE (ref == Approx { actual }.margin (1.0e-4f));
30- // }
31- // }
32- //
33- // SECTION ("Resistor/Capacitor Parallel")
34- // {
35- // static constexpr auto r_val = 2000.0f;
36- // static constexpr auto c_val = 2.0e-6f;
37- //
38- // ResistorT<float> r1 { r_val };
39- // CapacitorT<float> c1 { c_val };
40- // WDFParallelT<float, decltype (r1), decltype (c1)> p1 { r1, c1 };
41- //
42- // ResistorCapacitorParallelT<float> rc1 { r_val, c_val };
43- //
44- // float inputs[] = { 0.0f, 1.0f, -1.0f, 2.0f, -3.0f };
45- // for (auto& a : inputs)
46- // {
47- // p1.incident (a);
48- // const auto ref = p1.reflected();
49- //
50- // rc1.incident (a);
51- // const auto actual = rc1.reflected();
52- //
53- // REQUIRE (ref == Approx { actual }.margin (1.0e-4f));
54- // }
55- // }
56- //
57- // SECTION ("Resistor/Capacitor/Voltage Source Series")
58- // {
59- // static constexpr auto r_val = 2000.0f;
60- // static constexpr auto c_val = 2.0e-6f;
61- // static constexpr auto source_v = 1.5f;
62- //
63- // ResistiveVoltageSourceT<float> rv1 { r_val };
64- // rv1.setVoltage (source_v);
65- // CapacitorT<float> c1 { c_val };
66- // WDFSeriesT<float, decltype (rv1), decltype (c1)> s1 { rv1, c1 };
67- //
68- // ResistiveCapacitiveVoltageSourceT<float> rc1 { r_val, c_val };
69- // rc1.setVoltage (source_v);
70- // rc1.reset();
71- //
72- // float inputs[] = { 0.0f, 1.0f, -1.0f, 2.0f, -3.0f };
73- // for (auto& a : inputs)
74- // {
75- // s1.incident (a);
76- // const auto ref = s1.reflected();
77- //
78- // rc1.incident (a);
79- // const auto actual = rc1.reflected();
80- //
81- // REQUIRE (ref == Approx { actual }.margin (1.0e-4f));
82- // }
83- // }
9+ SECTION (" Resistor/Capacitor Series" )
10+ {
11+ static constexpr auto r_val = 2000 .0f ;
12+ static constexpr auto c_val = 2 .0e-6f ;
13+
14+ ResistorT<float > r1 { r_val };
15+ CapacitorT<float > c1 { c_val };
16+ WDFSeriesT<float , decltype (r1), decltype (c1)> s1 { r1, c1 };
17+
18+ ResistorCapacitorSeriesT<float > rc1 { r_val, c_val };
19+
20+ float inputs[] = { 0 .0f , 1 .0f , -1 .0f , 2 .0f , -3 .0f };
21+ for (auto & a : inputs)
22+ {
23+ s1.incident (a);
24+ const auto ref = s1.reflected ();
25+
26+ rc1.incident (a);
27+ const auto actual = rc1.reflected ();
28+
29+ REQUIRE (ref == Approx { actual }.margin (1 .0e-4f ));
30+ }
31+ }
32+
33+ SECTION (" Resistor/Capacitor Parallel" )
34+ {
35+ static constexpr auto r_val = 2000 .0f ;
36+ static constexpr auto c_val = 2 .0e-6f ;
37+
38+ ResistorT<float > r1 { r_val };
39+ CapacitorT<float > c1 { c_val };
40+ WDFParallelT<float , decltype (r1), decltype (c1)> p1 { r1, c1 };
41+
42+ ResistorCapacitorParallelT<float > rc1 { r_val, c_val };
43+
44+ float inputs[] = { 0 .0f , 1 .0f , -1 .0f , 2 .0f , -3 .0f };
45+ for (auto & a : inputs)
46+ {
47+ p1.incident (a);
48+ const auto ref = p1.reflected ();
49+
50+ rc1.incident (a);
51+ const auto actual = rc1.reflected ();
52+
53+ REQUIRE (ref == Approx { actual }.margin (1 .0e-4f ));
54+ }
55+ }
56+
57+ SECTION (" Resistor/Capacitor/Voltage Source Series" )
58+ {
59+ static constexpr auto r_val = 2000 .0f ;
60+ static constexpr auto c_val = 2 .0e-6f ;
61+ static constexpr auto source_v = 1 .5f ;
62+
63+ ResistiveVoltageSourceT<float > rv1 { r_val };
64+ rv1.setVoltage (source_v);
65+ CapacitorT<float > c1 { c_val };
66+ WDFSeriesT<float , decltype (rv1), decltype (c1)> s1 { rv1, c1 };
67+
68+ ResistiveCapacitiveVoltageSourceT<float > rc1 { r_val, c_val };
69+ rc1.setVoltage (source_v);
70+ rc1.reset ();
71+
72+ float inputs[] = { 0 .0f , 1 .0f , -1 .0f , 2 .0f , -3 .0f };
73+ for (auto & a : inputs)
74+ {
75+ s1.incident (a);
76+ const auto ref = s1.reflected ();
77+
78+ rc1.incident (a);
79+ const auto actual = rc1.reflected ();
80+
81+ REQUIRE (ref == Approx { actual }.margin (1 .0e-4f ));
82+ }
83+ }
8484
8585 SECTION (" Capacitive Voltage Source" )
8686 {
0 commit comments