@@ -24,11 +24,9 @@ SCENARIO("Parsing scripts", "[code]") {
24
24
const auto code = " - 4 ^ 2" _code;
25
25
26
26
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 );
32
30
33
31
const auto parsed = code.Parse (false );
34
32
DumpResults (code, parsed, required);
@@ -48,13 +46,13 @@ SCENARIO("Parsing scripts", "[code]") {
48
46
const auto code = " - .Sampler.y ^ 2" _code;
49
47
50
48
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>()}
55
53
)
56
- }
57
- }.SetMass (-1 );
54
+ )
55
+ }} .SetMass (-1 );
58
56
59
57
const auto parsed = code.Parse ();
60
58
DumpResults (code, parsed, required);
@@ -66,26 +64,24 @@ SCENARIO("Parsing scripts", "[code]") {
66
64
const auto code = " Vec2(.Sampler.x, -(.Time * 8.75 - .Sampler.y ^ 2))" _code;
67
65
68
66
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>()}
85
76
)
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
+ ));
89
85
90
86
const auto parsed = code.Parse ();
91
87
DumpResults (code, parsed, required);
@@ -95,11 +91,9 @@ SCENARIO("Parsing scripts", "[code]") {
95
91
96
92
GIVEN (" The script: Create^1(Count(1)) Add^3 2" ) {
97
93
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 );
103
97
104
98
WHEN (" Parsed" ) {
105
99
const auto parsed = code.Parse ();
@@ -110,11 +104,9 @@ SCENARIO("Parsing scripts", "[code]") {
110
104
111
105
GIVEN (" The script: Create^1(Count(1)) Add^3(2)" ) {
112
106
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 );
118
110
119
111
WHEN (" Parsed" ) {
120
112
const auto parsed = code.Parse ();
@@ -126,13 +118,10 @@ SCENARIO("Parsing scripts", "[code]") {
126
118
GIVEN (" The script: Create^1(Count(1)) Add^2(2) Multiply^3(4)" ) {
127
119
const Code code = " Create^1(Count(1)) Add^2(2) Multiply^3(4)" ;
128
120
const Many multiply = Verbs::Multiply {Real (4 )}
129
- .SetSource (Real (2 ))
130
- .SetRate (3 );
121
+ .SetSource (Real (2 )).SetRate (3 );
131
122
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 )
136
125
);
137
126
138
127
WHEN (" Parsed" ) {
@@ -144,10 +133,8 @@ SCENARIO("Parsing scripts", "[code]") {
144
133
145
134
GIVEN (" The script: Create^1(Count(1)) + 2 * 4" ) {
146
135
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 )
151
138
);
152
139
153
140
WHEN (" Parsed" ) {
@@ -162,10 +149,8 @@ SCENARIO("Parsing scripts", "[code]") {
162
149
const Many exponent = Verbs::Exponent {Real (2 )}
163
150
.SetSource (Real (14 ));
164
151
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 ))
169
154
);
170
155
const Many required = Verbs::Add {addition}
171
156
.SetMass (-1 );
0 commit comments