Skip to content

Commit f3e074f

Browse files
committed
Adapting tests
1 parent 08f0018 commit f3e074f

File tree

2 files changed

+42
-55
lines changed

2 files changed

+42
-55
lines changed

source/Vectors/TVector.inl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ namespace Langulus::Math
107107
static_assert(D::Index < S, "LHS doesn't have such dimension");
108108
all[D::Index] = Adapt(source.mValue);
109109
}
110-
110+
111+
/// Construct from a SIMD register
112+
/// @param source - register
111113
TEMPLATE() LANGULUS(INLINED)
112114
TME()::TVector(const CT::SIMD auto& source) noexcept {
113115
SIMD::Store(source, all);

test/TestFlow.cpp

Lines changed: 39 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ SCENARIO("Parsing scripts", "[code]") {
2424
const auto code = "- 4 ^ 2"_code;
2525

2626
WHEN("Parsed without optimization") {
27-
Many required = Verbs::Add {
28-
Many {Verbs::Exponent {Real(2)}
29-
.SetSource(Real(4))
30-
}
31-
}.SetMass(-1);
27+
Many required = Verbs::Add {Many {
28+
Verbs::Exponent {Real(2)}.SetSource(Real(4))
29+
}}.SetMass(-1);
3230

3331
const auto parsed = code.Parse(false);
3432
DumpResults(code, parsed, required);
@@ -48,13 +46,13 @@ SCENARIO("Parsing scripts", "[code]") {
4846
const auto code = "- .Sampler.y ^ 2"_code;
4947

5048
WHEN("Parsed without optimization") {
51-
Many required = Verbs::Add {
52-
Many {Verbs::Exponent {Real(2)}
53-
.SetSource(Verbs::Select {MetaOf<Traits::Y>()}
54-
.SetSource(Verbs::Select {MetaOf<Traits::Sampler>()})
49+
Many required = Verbs::Add {Many {
50+
Verbs::Exponent {Real(2)}.SetSource(
51+
Verbs::Select {MetaOf<Traits::Y>()}.SetSource(
52+
Verbs::Select {MetaOf<Traits::Sampler>()}
5553
)
56-
}
57-
}.SetMass(-1);
54+
)
55+
}}.SetMass(-1);
5856

5957
const auto parsed = code.Parse();
6058
DumpResults(code, parsed, required);
@@ -66,26 +64,24 @@ SCENARIO("Parsing scripts", "[code]") {
6664
const auto code = "Vec2(.Sampler.x, -(.Time * 8.75 - .Sampler.y ^ 2))"_code;
6765

6866
WHEN("Parsed without optimization") {
69-
Many required = Construct::From<Vec2>(
70-
Verbs::Select {MetaOf<Traits::X>()}
71-
.SetSource(
72-
Verbs::Select {MetaOf<Traits::Sampler>()}
73-
),
74-
Verbs::Add {
75-
Many {Verbs::Add {
76-
Many {Verbs::Exponent {Real(2)}
77-
.SetSource(
78-
Verbs::Select {MetaOf<Traits::Y>()}
79-
.SetSource(Verbs::Select {MetaOf<Traits::Sampler>()})
80-
)}
81-
}.SetSource(
82-
Verbs::Multiply {Real(8.75)}
83-
.SetSource(
84-
Verbs::Select {MetaOf<Traits::Time>()}
67+
Many required = Construct::From<Vec2>(Many::Wrap<Verb>(
68+
Verbs::Select {MetaOf<Traits::X>()}.SetSource(
69+
Verbs::Select {MetaOf<Traits::Sampler>()}
70+
),
71+
Verbs::Add {Many {
72+
Verbs::Add {Many {
73+
Verbs::Exponent {Real(2)}.SetSource(
74+
Verbs::Select {MetaOf<Traits::Y>()}.SetSource(
75+
Verbs::Select {MetaOf<Traits::Sampler>()}
8576
)
86-
).SetMass(-1)}
87-
}.SetMass(-1)
88-
);
77+
)
78+
}}.SetSource(
79+
Verbs::Multiply {Real(8.75)}.SetSource(
80+
Verbs::Select {MetaOf<Traits::Time>()}
81+
)
82+
).SetMass(-1)
83+
}}.SetMass(-1)
84+
));
8985

9086
const auto parsed = code.Parse();
9187
DumpResults(code, parsed, required);
@@ -95,11 +91,9 @@ SCENARIO("Parsing scripts", "[code]") {
9591

9692
GIVEN("The script: Create^1(Count(1)) Add^3 2") {
9793
const Code code = "Create^1(Count(1)) Add^3 2";
98-
const Many required = Verbs::Add {Real(2)}
99-
.SetSource(
100-
Verbs::Create {Traits::Count {Real(1)}}
101-
.SetRate(1))
102-
.SetRate(3);
94+
const Many required = Verbs::Add {Real(2)}.SetSource(
95+
Verbs::Create {Traits::Count {Real(1)}}.SetRate(1)
96+
).SetRate(3);
10397

10498
WHEN("Parsed") {
10599
const auto parsed = code.Parse();
@@ -110,11 +104,9 @@ SCENARIO("Parsing scripts", "[code]") {
110104

111105
GIVEN("The script: Create^1(Count(1)) Add^3(2)") {
112106
const Code code = "Create^1(Count(1)) Add^3(2)";
113-
const Many required = Verbs::Add {Real(2)}
114-
.SetSource(
115-
Verbs::Create {Traits::Count {Real(1)}}
116-
.SetRate(1))
117-
.SetRate(3);
107+
const Many required = Verbs::Add {Real(2)}.SetSource(
108+
Verbs::Create {Traits::Count {Real(1)}}.SetRate(1)
109+
).SetRate(3);
118110

119111
WHEN("Parsed") {
120112
const auto parsed = code.Parse();
@@ -126,13 +118,10 @@ SCENARIO("Parsing scripts", "[code]") {
126118
GIVEN("The script: Create^1(Count(1)) Add^2(2) Multiply^3(4)") {
127119
const Code code = "Create^1(Count(1)) Add^2(2) Multiply^3(4)";
128120
const Many multiply = Verbs::Multiply {Real(4)}
129-
.SetSource(Real(2))
130-
.SetRate(3);
121+
.SetSource(Real(2)).SetRate(3);
131122
const Many required = Verbs::Add {multiply}
132-
.SetRate(2)
133-
.SetSource(
134-
Verbs::Create {Traits::Count {Real(1)}}
135-
.SetRate(1)
123+
.SetRate(2).SetSource(
124+
Verbs::Create {Traits::Count {Real(1)}}.SetRate(1)
136125
);
137126

138127
WHEN("Parsed") {
@@ -144,10 +133,8 @@ SCENARIO("Parsing scripts", "[code]") {
144133

145134
GIVEN("The script: Create^1(Count(1)) + 2 * 4") {
146135
const Code code = "Create^1(Count(1)) + 2 * 4";
147-
const Many required = Verbs::Add {Real(8)}
148-
.SetSource(
149-
Verbs::Create {Traits::Count {Real(1)}}
150-
.SetRate(1)
136+
const Many required = Verbs::Add {Real(8)}.SetSource(
137+
Verbs::Create {Traits::Count {Real(1)}}.SetRate(1)
151138
);
152139

153140
WHEN("Parsed") {
@@ -162,10 +149,8 @@ SCENARIO("Parsing scripts", "[code]") {
162149
const Many exponent = Verbs::Exponent {Real(2)}
163150
.SetSource(Real(14));
164151
const Many addition = Verbs::Add {exponent}
165-
.SetMass(-1)
166-
.SetSource(
167-
Verbs::Multiply {Real(8.75)}
168-
.SetSource(Real(2))
152+
.SetMass(-1).SetSource(
153+
Verbs::Multiply {Real(8.75)}.SetSource(Real(2))
169154
);
170155
const Many required = Verbs::Add {addition}
171156
.SetMass(-1);

0 commit comments

Comments
 (0)